Jump to content

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/161381-return-posted-values/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851675
Share on other sites

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?

 

Link to comment
https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851681
Share on other sites

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?

 

Link to comment
https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851683
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851686
Share on other sites

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...

Link to comment
https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851687
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851825
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/161381-return-posted-values/#findComment-851831
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.