tags:

views:

20

answers:

2

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!

+1  A: 

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);
Sarfraz
A: 

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().

Wizzard