On my website I have two sections: compras
and ventas
Each with a different layout
. In each one the user can consult his personal data and modify them, the case is that when he is showing the same information I would be interested in using the same script php
in both situations. To show the data there is no problem, but when making UPDATE
to the database the script redirects the user to another page, in this case to the main shopping page.
But even if the user modified the data from the sales section, he would also redirect it to the purchasing section since I do not know how to differentiate where the user is.
The code I have:
//hago la conexión con la bdd, etc.
mysqli_set_charset($conexion, "utf8");
//consulta sql
$registro="UPDATE usu_datos SET Usu_Nom = '$nom' WHERE Usu_Usu = '$usr'; "
. "UPDATE usu_datos SET Usu_Apel = '$apl' WHERE Usu_Usu = '$usr'; ";
$resultados= mysqli_multi_query($conexion, $registro);
//verificación de los resultados
if($resultados==false){
}else{
//aquí mi PROBLEMA, ahora re-dirige al siguiente enlace
header('Location:../login/compras.php');
//pero dependiendo de la sección tendría que re-dirigir a otro lugar
header('Location:../login/ventas.php');
}
The current form used in the purchasing and sales section is the same:
<form name="form1" method="post" action="../validadores_datos_usuario/validar_datos_usuario.php" enctype="multipart/form-data">
<ul style="width: 60%; float: left;">
<li>
<label class="usrDataLbl " for="nombre"> Nombre</label>
</li>
<li>
<input class="usrData shadow noBorder" id="usrNombre" type="text" name="nombre" value=<?php echo "'" . $nombre . "'" ?> >
</li>
<li>
<label class="usrDataLbl" for="apellidos"> Apellidos</label>
</li>
<li>
<input class="usrData shadow noBorder" id="usrApellidos" type="text" name="apellidos" value=<?php echo "'" . $apellidos . "'" ?> >
</li>
<li>
<label class="usrDataLbl " for="usuario"> Usuario</label>
</li>
<li>
<input class="usrData shadow noBorder" id="usrUsuario" type="zz" name="usuario" value=<?php echo "'" . $usuario . "'" ?> disabled> </li>
<li>
<label class="usrDataLbl" for="pregunta_seguridad"> Pregunta de seguridad</label>
</li>
<li>
<input class="usrData shadow noBorder" id="usrUsuario " type="text" name="pregunta_seguridad" readonly value=<?php echo "'" . $pregunta . "'" ?>>
</li>
<li>
<label class="usrDataLbl" for="pregunta_seguridad"> Respuesta de seguridad</label>
</li>
<li>
<input class="usrData shadow noBorder" id="usrUsuario " type="text" name="respuesta_seguridad" readonly value=<?php echo "'" . $respuesta . "'" ?>>
</li>
<li class="margin-top-10"></li>
<li>
<input class="botonTipo1 margin-top-10 margin-right-10" type="submit" name="guardar_dat_usr" id="btn-validarDatosPersonales" value="Guardar" >
<input type="reset" class="botonTipo2 margin-top-10" onclick="cancelarInfoUsr()" value="Cancelar">
</li>
</ul>
<div style="float: right; width:250px; height: 250px; border: 7px solid rgb(230,230,230); overflow: hidden ">
<img style="width: 100%; vertical-align: middle; " src=<?php echo $foto ?> >
</div>
<input type="file" name="imagen" id="prodImg_1" class="shadow inputfile inputfile-1" data-multiple-caption="{count} archivos seleccionados" multiple />
<label style="float: right; margin-top: 10px; width: 250px" for="prodImg_1">
<i class="fa fa-cloud-upload" style="font-size:24px"></i>
<span class="iborrainputfile">Seleccionar archivo</span>
</label>
<img id="target"/>
</form>
Is there a method to identify from which form the data is entered in order to choose the landing page?