Make an update to fill in missing fields in a BDD table

1

I need help to update and fill data in my database, I have a form and its corresponding PHP code, I want the user who is logged in to change his data only (I have a Session page) My form is:

<FORM method="post">

    <P>Pais:</P>    
    <INPUT type="text" name="pa">
    <BR>
    <BR>
    <P>Estado:</P>
    <INPUT type="text" name="est">
    <BR>
    <BR>
    <P>Ciudad:</P>
    <INPUT type="text" name="ciud">
    <BR>
    <BR>
    <P>Calle:   </P>
    <INPUT type="text" name="call">
    <BR>
    <BR>
    <P>Telefono:</P>
    <INPUT type="text" name="tel">
    <BR>
    <BR>
    <BR>
    <INPUT type="Submit" name="boton" value="Registrar">
    <BR>
</FORM>

My code is php:

<?PHP
include "conexion.php";
session_start();
$pais=$_REQUEST['pa'];
$estado=$_REQUEST['est'];
$ciudad=$_REQUEST['ciud'];
$calle=$_REQUEST['call'];
$telefono=$_REQUEST['tel'];

    mysqli_query($conexion,"UPDATE usuarios set 
    ".$pais",".$estado",".$ciudad",".$calle",".$telefono" where User=$_SESSION[usuario]")
or die("Problemas en el Update: ".mysqli_error($conexion));

mysqli_close($conexion);        

The page with session is:

$registros = mysqli_query($conexion, "select * from usuarios where Email = '$_REQUEST[mail]'")
            or die("Problemas en el select: ".mysql_error($conexion));

if ($reg = mysqli_fetch_array($registros))
{

    $verificar = mysqli_query($conexion, "select * from usuarios where Email = '$_REQUEST[mail]' and password = '$_REQUEST[pass]'")
                or die("Problemas en el select: ".mysql_error($conexion));

    if($ver = mysqli_fetch_array($verificar)){
        @session_start();
        $_SESSION["Auntentificado"] = "SIP";
        $_SESSION["usuario"] = $ver["User"];
        header ("Location: FramesInicioUnion.php");
    }
    else
    {
        header ("Location: InicioFallido.php");         
    }
    }
    else
    {
        echo "<CENTER><h1>No se ah encontrado un usuario registrado en nuestra base de datos o alguno de los datos ingresados es incorrecto.</h1></CENTER>";    
        header ("Location: InicioFallido.php");         
    }
mysqli_close($conexion);
    
asked by Juan Alejandro 04.07.2018 в 05:29
source

0 answers