Reputation: 171
I have a simple html file with the code below. It calls submitform.php. But nothing gets displayed. Any ideas?
<html>
<body>
<form action=submitform.php method=GET>
First Name: <input type=text name=first_name size=25 maxlength=25>
Last Name: <input type=text name=last_name size=25 maxlength=25>
<p>
<input type=submit>
</form>
</body>
</html>
php code in submitform.php:
<html>
<body>
<?php
print ($first_name);
echo $first_name;
print (" ");
print ($last_name);
print ("<p>");
print ("Thanks for submitting your name.");
?>
</body>
</html>
Thanks!
Upvotes: 0
Views: 324
Reputation: 114
You could also set "register_globals on" in your php.ini file to have access to both GET and POST variables w/o $_GET[] and extract().
Upvotes: 0
Reputation: 382806
Instead of:
print ($first_name);
Use
print ($_GET['first_name']);
You are using the GET method of the form.
However, if you still want to use:
print ($first_name);
Then on top of your php file place this line:
extract($_GET);
Upvotes: 1