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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
smitty575
Forum Newbie
Posts: 2
Joined: Tue Oct 07, 2008 5:44 am

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

Post 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:
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

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

Post 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'];
 
smitty575
Forum Newbie
Posts: 2
Joined: Tue Oct 07, 2008 5:44 am

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

Post by smitty575 »

That was most helpful, thank you. Now I can move on to the next step in my project :D
Post Reply