Page 1 of 1

How do I use a Form Value in one page and use it on another?

Posted: Tue Oct 07, 2008 6:06 am
by smitty575
This is a newbie question but it has me stumped
I have two .php pages debug1.php and debug2.php

debug1.php

<form method=post action=debug2.php>
<table border="0">
<tr><td>Email:</td><td>
<input type="text" name=email maxlength="65">
</td></tr>
<tr><td>Password:</td><td>
<input type="password" name=pass maxlength="15">
</td></tr>
<tr><td>Confirm Password:</td><td>
<input type="password" name=pass2 maxlength="15">
</td></tr>
<tr><th colspan=2><input type="submit" name="submit" value="Register"></th></tr> </table>
</form>

debug2.php

<?php
$flag="OK";
$test=' Test' ;

print $flag.$test.$email ;
?>

When I enter an email address in debug1.php and press Register
debug2.php responds with OK Test but no email address
I am obviously doing something wrong but for the life of me I can't see it
After you have a good laugh, this newbie would appreciate a little help :banghead:

Re: How do I use a Form Value in one page and use it on another?

Posted: Tue Oct 07, 2008 6:16 am
by aceconcepts
Surround the name of your form elements with quotes name="email" etc...

To get posted values you can use:

Code: Select all

 
$email=$_POST['email'];
 

Re: How do I use a Form Value in one page and use it on another?

Posted: Tue Oct 07, 2008 10:36 am
by smitty575
That was most helpful, thank you. Now I can move on to the next step in my project :D