Passing variables?

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
chrizzis
Forum Newbie
Posts: 5
Joined: Tue Jun 23, 2009 12:45 am

Passing variables?

Post 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
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Passing variables?

Post by VladSun »

$_POST['firstname'] ...
There are 10 types of people in this world, those who understand binary and those who don't
chrizzis
Forum Newbie
Posts: 5
Joined: Tue Jun 23, 2009 12:45 am

Re: Passing variables?

Post by chrizzis »

Worked! Thanks!
Post Reply