Variables Don't Work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Damolisher
Forum Newbie
Posts: 1
Joined: Thu Feb 06, 2003 3:35 pm

Variables Don't Work

Post 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.
bionicdonkey
Forum Contributor
Posts: 132
Joined: Fri Jan 31, 2003 2:28 am
Location: Sydney, Australia
Contact:

Post by bionicdonkey »

Code: Select all

<? echo $_POST['YourName']; ?>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

please read Sticky: Before Post Read: Concerning Passing Variables in PHP 4.2+
It's not a sticky thread for nothing ;)
Post Reply