Page 1 of 1

Variables Don't Work

Posted: Thu Feb 06, 2003 3:35 pm
by Damolisher
I installed php using the newest version of Foxserv, which also included the mysql db. I have postnuke and phpnuke running, b/c i can't decide which one to use, and both work well. But, when i try to write my own scripts, the variables don't work. Here are the two pages i wrote:

This is test.html:
<html>
<head>
<title>My Form</title>
</head>
<body>

<form action="bad_words.php" method="post">

My name is:
<br> <input type="text" name="YourName">

<p> My favorite dirty word is:
<br> <input type="text" name="FavoriteWord">
<p>

<input type="submit" name="submit" value="Enter">
</form>

</body>
</html>

And this is bad_words.php:
<html>
<head>
<title>Perv!</title>

</head>

<body bgcolor="#FFFFFF" text="#000000">
<p>
Hi <?php print $YourName; ?>

<p>
You like the word <b> <?php print $FavoriteWord; ?> !?! </b>

<p>You oughta be ashamed of yourself!

</body>
</html>

I got all this off a tutorial, so i think it should work, but, all i get on bad_words.php is like "You like the word !?!" without anything i put into the form in there at all, this is the same with "Hi." When i say get instead of post, the var's and their values show up in the url, but it still doesn't work. NEone know what is the problem. I've been told i may have to change something in my php.ini file, but i don't know what to change, and Foxserv didn't have one: it had php.inirecommend and php.inidefault. I renamed php.inidefault as php.ini, and it became a config file, but it still didn't work. I have win XP. Any ideas? Thanx a lot.

Posted: Thu Feb 06, 2003 4:25 pm
by bionicdonkey

Code: Select all

<? echo $_POST['YourName']; ?>

Posted: Fri Feb 07, 2003 12:09 am
by volka
please read Sticky: Before Post Read: Concerning Passing Variables in PHP 4.2+
It's not a sticky thread for nothing ;)