Click to See Complete Forum and Search --> : PHP Little Help!


Anoir
May 17th, 2011, 10:16 AM
I created a VIP Area and the registration folder contains 3 pages, each page has labels or fields if you wanna say, the problem is that i only got the last page infos, yet the first n' second one i dont receive its infos if someone's registered on it,

i used the method of POST, $_POST

For example :

(PAGE 1)
<input name="firstname" maxlength="20" size="20" class="form-input" type="text" validate="required:true , number:true" />

(PAGE 2)
<?
$FirstName .= $_POST['firstname'];
?>

<form method="POST" action="PAGE3.php">
<input type="hidden" name="firstname" value="<?php echo($FirstName); ?>">

(PAGE3)
the same again with page 3 fields

<?
$FirstName .= $_POST['firstname'];
?>

<form method="POST" action="PAGE3.php">
<input type="hidden" name="firstname" value="<?php echo($FirstName); ?>">

Finally I got only the Page3 Posted fields, non of Page1 or Page2 been recieved at all, it comes empty

$message .= "First Name: ".$_POST['firstname']."\n";

Please help me to fix this..

PeejAvery
May 17th, 2011, 12:06 PM
First off, unless you have short php tag turned on in your configuration file, your <? ... ?> is not even going to be interpreted. Always use <?php ... ?>.

Second, there is no validate attribute for the <input> tag.

Third, you should not be using .= unless you're concatenating variables. In your example, you're just creating them. So just set them as equal.

Last, why do you have page 3 redirecting to page 3 again?

Anoir
May 21st, 2011, 06:35 AM
Well I guess you didn't understand because I didn't put the whole source code, wait for me i'll upload it for ya

PeejAvery
May 21st, 2011, 07:13 AM
Yes, I did understand. And I replied by helping you correct some code. Apparently you did not understand.

Also, why are you using echo like you do? Here's the proper way...

<?php echo 'Text to be outputted'; // notice no parenthesis ?>

Anoir
May 21st, 2011, 11:54 AM
Well I'm sorry then :)
I'm just asking if there's a good way to get Forms result in 3 pages or even 4 pages, i mean each page contains a form and when u go to the next step which is page 2 you will find another form and the same thing with the next steps until u finish them, you must receive the full results of that forms. the question is what methods is good and easy to make it :) u got me now?

PeejAvery
May 21st, 2011, 11:59 AM
Use sessions (http://us2.php.net/manual/en/book.session.php) to carry data across multiple sessions...not back to back forms.