Page 1 of 1

Passing variables?

Posted: Tue Jun 23, 2009 12:59 am
by chrizzis
Hello,
I have created a simple html page called welcome.html:

<FORM ACTION="welcome.php" METHOD=POST>
First Name: <INPUT TYPE=TEXT NAME="firstname"><BR>
Last Name: <INPUT TYPE=TEXT NAME="lastname">
<INPUT TYPE=SUBMIT VALUE="GO">
</FORM>

Then I created a php script called welcome.php and placed it in the same folder as the .html script:

<?php
echo( "Welcome to our Web site, $firstname $lastname!" );
?>

When I type the text and push the button, I see the php script has run, but the variables are empty. I tried it using scripts from another tutorial, and the same thing happens:

Welcome to our Web site, !

What am I doing wrong?
Thanks,
Chris

Re: Passing variables?

Posted: Tue Jun 23, 2009 2:42 am
by VladSun
$_POST['firstname'] ...

Re: Passing variables?

Posted: Tue Jun 23, 2009 4:04 pm
by chrizzis
Worked! Thanks!