Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why aren't my form values being passed to the next page?

Debugging PHP

Why aren't my form values being passed to the next page?

by  jimoblak  Posted    (Edited  )
Some basic PHP tutorials show how you can access data passed in a form in this manner:

FORM.HTML
Code:
<form name="myform" action="RESULT.PHP" method="post">
<input type="text" name="mydata">
<input type="submit" value="Submit">
</form>

RESULT.PHP
Code:
<?php
print 'You entered: ' . $mydata;
?>

This is a very simple and insecure method of passing data. If this script does not work for you, then PHP has been configured with register_globals set to OFF in the php.ini file. All installations of PHP 4.2.0 and above default to OFF.

The correct way to obtain the data in the example above is:
RESULT.PHP
Code:
<?php
print 'You entered: ' . $_POST[mydata];
?>

Further details are explained at:
http://www.php.net/manual/en/security.registerglobals.php
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top