Page 1 of 1

query strings

Posted: Fri Jun 13, 2003 11:21 pm
by paul_r
hello! i have a problem passing data from one page to another. I made two sample pages:

//getname.html
<html>
<body>
<form action="handler.php" method="get">
first name: <input type="text" name="FirstName">
<input type="submit" value="submit">
</form>
</body>
</html>

//handler.php
<html>
<body>
<?php
print "hello $FirstName";
?>
</body>
</html>

after pressing the submit button on the first page, i get redirected to the second. in the second page, instead of dipslaying hello paul, i get an error saying that the variable $FirstName is unknown. I'm using microsoft IIS. I already installed php to it. It also has asp.net. Asp.net works fine. do you think my problem is because of having these two on one server? Or do I just have to configure something in my server? thanks!

Posted: Fri Jun 13, 2003 11:24 pm
by Paddy
You were almost there. Put

Code: Select all

<?php
$FirstName = $_GET['FirstName'];
?>
Above <html> in your handler.php file. You must get the submitted info before you can use it.

Posted: Sat Jun 14, 2003 3:38 am
by volka
and read Sticky: Before Post Read: Concerning Passing Variables in PHP 4.2+
it's not a sticky thread for nothing ;)

Posted: Sat Jun 14, 2003 10:41 pm
by paul_r
ok. sorry about that. thanks anyway!