Julian Posted June 8, 2009 Share Posted June 8, 2009 Hello I found a solution to my problem in other thread here: http://www.phpfreaks.com/forums/index.php?topic=224173.0. But I'm having a issue maybe someone can help me.. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $nombre = $_POST['nombre']; $apellido1 = $_POST['apellido1']; $apellido2 = $_POST['apellido2']; ... I set the values, but I get only the first value ($nombre) when I submit the form the other ones are not showing. I'm using: <input name="nombre" type="text" class="dsR1174" id="nombre" value="<?php echo (isset($nombre) ? $nombre : ''); ?>" size="31" /> <input name="apellido1" type="text" class="dsR1174" id="apellido1" value="<?php echo (isset($apellido1) ? $apellido1 : ''); ?>" size="31" /> ... Regards Quote Link to comment https://forums.phpfreaks.com/topic/161381-return-posted-values/ Share on other sites More sharing options...
MadTechie Posted June 8, 2009 Share Posted June 8, 2009 i would assume their not getting sent! Quote Link to comment https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851665 Share on other sites More sharing options...
Julian Posted June 8, 2009 Author Share Posted June 8, 2009 Yes, I though so. But the values are passed correctly. I changed the the method for GET to test the form and the values are there, all of them. Any other solution? Quote Link to comment https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851669 Share on other sites More sharing options...
PFMaBiSmAd Posted June 8, 2009 Share Posted June 8, 2009 If they are present in the URL when the method is GET, but only one is present at some point in your code when using POST, your code is likely overwriting them or you have register_globals on and have different type variables with the same name that are overwriting them. What does the following show when put at the start of your php code - <?php echo "<pre>"; echo "POST:"; print_r($_POST); echo "</pre>"; ?> If the values are present at the start of your code but not present later, it must be something your code is doing between those two points. Quote Link to comment https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851675 Share on other sites More sharing options...
Julian Posted June 8, 2009 Author Share Posted June 8, 2009 Thanks for the help. Here's what I get: POST:Array ( [nombre] => xxx [apellido1] => xxxx [apellido2] => xxxx [nacimiento] => 2009-06-08 [telefono] => xxxxx [celular] => xxxxx [fax] => xxxxx => xxxxxxx [web] => xxxxxx [provincia] => 1 [direccion] => ss [username] => ss [pass] => ss [pass2] => ss [user_code] => [submitButtonName] => Continuar [MM_insert] => form1 ) Any other suggestion? Quote Link to comment https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851681 Share on other sites More sharing options...
Julian Posted June 8, 2009 Author Share Posted June 8, 2009 when errors are present I use the following script: (this one verifies the email address) $sql = "SELECT email FROM perfil WHERE email='" . $_POST['email'] . "'"; $result = mysql_query($sql); if (mysql_num_rows($result) >= 1) { $error = $PHP_SELF . "?msg=Este email ya ha sido registrado."; header ("Location: $error"); exit(); Could be the use of exit(); that is causing the lost of info... Can I use die instead but show the error under the input text? Quote Link to comment https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851683 Share on other sites More sharing options...
PFMaBiSmAd Posted June 8, 2009 Share Posted June 8, 2009 when I submit the form the other ones are not showing The other values are not showing where? I don't think we know exactly what problem you are having. It appears that the values are present in the $_POST data at the start of your code. Where exactly are they not showing up? Quote Link to comment https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851686 Share on other sites More sharing options...
Julian Posted June 8, 2009 Author Share Posted June 8, 2009 When errors are present I return to the form. I don't want the user fill the form again so I returning the post values on the <input> fields as follows: <input name="nombre" type="text" class="dsR1174" id="nombre" value="<?php echo (isset($nombre) ? $nombre : ''); ?>" size="31" /> <input name="apellido1" type="text" class="dsR1174" id="apellido1" value="<?php echo (isset($apellido1) ? $apellido1 : ''); ?>" size="31" /> ... But as I wrote before only $nombre is returning... Quote Link to comment https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851687 Share on other sites More sharing options...
PFMaBiSmAd Posted June 8, 2009 Share Posted June 8, 2009 So, is your form on the same page as the form processing code? If not, how are you passing the values back to the form? Quote Link to comment https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851817 Share on other sites More sharing options...
Julian Posted June 8, 2009 Author Share Posted June 8, 2009 Yes, the form processes on the same page: <form action="<?php echo $editFormAction; ?>" method="post" enctype="multipart/form-data" name="form1" id="form1" onSubmit="return formCheck(this);"> Thanks for following the thread... Quote Link to comment https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851824 Share on other sites More sharing options...
PFMaBiSmAd Posted June 8, 2009 Share Posted June 8, 2009 Since the form and the form processing code are on the same page - If the values are present at the start of your code but not present later, it must be something your code is doing between those two points. We cannot directly help with what your code is doing unless you post it. Quote Link to comment https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851825 Share on other sites More sharing options...
alco19357 Posted June 8, 2009 Share Posted June 8, 2009 it's really hard without any code to check. are you doing an if.. else statement? so maybe if the the name isn't set, then it just stops parsing the rest? also, where are you storing the entered values in which you call to later to populate the form? more information/code would greatly help Quote Link to comment https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851831 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.