Help with Xampp

I am running xampp on my laptop with windows vista and I am having a little bit of trouble with connecting .html documents with .php files. I have just started using apache and php and for some reason when i create a form to with a text box for user input i cannot get the end result that i want. i cannot get the php to create the variable from the user input box and display it. Please hlep! heres the code

What's your name?

What's your name?

Writing a form for user input

Please type your name:


Hi User

Hi User

PHP program that receives a value from "whatsName"

<? print "

Hi there, $userName!

"; ?>

you need to tell php to make the variable try this

$username = $_GET[username]

then you can tell it to echo out the variable

Thanx it worked, but is there a way to do this using the POST method instead of get?

$username = $_POST[username];

also make sure you secure the data if it’s going into a database:

//add to var
$username = $_POST[username];

//remove any html from it
$username = strip_tags($username);

//esacpe data
$username = mysql_real_escape_string($username);
Sponsor our Newsletter | Privacy Policy | Terms of Service