Page 1 of 1

Multi-step form

Posted: Sun Apr 04, 2004 9:40 am
by /usr/local/
Hi,

i am new to php but i am learning everyday new things.

Now i have problems with multi-step forms. How can i take datas from 1st .php pages for 3rd pages?

I want to use multi-step registration form on my site. But i didn't.

i am putting the codes here.


form1.php
<html>
<body>
<form name="form1" method="get" action="form2.php">
<p>Please enter your name<br>
<input name="name" type="text" id="name" size="15">
<input type="submit" name="Submit" value="next">
</p>
</form>
<p>step 1/3 </p>
</body>
</html>

------

form2.php
<?
$name=$HTTP_GET_VARS['name'];
?>
<html>

<body>
<p>Hello <? echo $name; ?> Now please enter your surname.</p>
<form name="form2" method="get" action="form3.php">
<p>
<input name="surname" type="text" id="surname" size="15">
<INPUT TYPE="hidden" name="name" value="<? $name ?>">
<input type="submit" name="Submit" value="next">

</p>
</form>
step 2/3
</body>
</html>

-------

step3.php
<? $name=$HTTP_GET_VARS['name']; ?>
<html>

<body>

<form name="form3" method="post" action="onayla.php">
<p>Your name:
<? echo $name;?>
</p>
<p>Surname:
<? echo $surname;?>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<p>Step 3/3 </p>
</body>
</html>



on form3.php i can't see my name.

how can i? please help me.

Thank you.

Posted: Sun Apr 04, 2004 11:07 am
by josh
on page 2
instead of
<INPUT TYPE="hidden" name="name" value="<? $name ?>">

put
<INPUT TYPE="hidden" name="name" value="<? echo("$name"); ?>">

Posted: Sun Apr 04, 2004 3:24 pm
by /usr/local/
you're great jshpro2 thanks a lot :)