FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


HTML Forms Problem





Tony The Tiger
I am now on page 6 of the tutorial (http://hotwired.lycos.com/webmonkey/01/48/index2a_page6.html?tw=programming )

I have created badwords_form.html

<html>
<head>
<title>My Form</title>
</head>
<body>

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

My name is:

<input type="text" name="YourName">

<p> My favorite dirty word is:

<input type="text" name="FavoriteWord">
<p>

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

</body>
</html>

and bad_words.php

<html>
<head>
<title>Perv!</title>

</head>

<body bgcolor="#FFFFFF" text="#000000">

<p>
Hi <?php print $YourName; ?>

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

<p>You oughta be ashamed of yourself!

</body>
</html>

When I go to http://127.0.0.1/badwords_form.html I enter TTT in the name and booty in the bad word box.

My result is the following:

Hi
Notice: Undefined variable: YourName in c:\program files\easyphp1-8\www\bad_words.php on line 7

You like the word
Notice: Undefined variable: FavoriteWord in c:\program files\easyphp1-8\www\bad_words.php on line 9
!?!

You oughta be ashamed of yourself!


I think this is a bad problem worth worrying about. Please advise
mathiaus
Your forms being posted so you need $_POST['inputname'] in your case $_POST['YourName'] and $_POST['FavoriteWord']
Your example will work but only when global vars are turned on
Tony The Tiger
If you want my complete phpinfo(); results, let me know.
Tony The Tiger
The change worked, but I don't understand why. Am I in the wrong environment to use the tutorial literally?
Bondings
The short urls only work on some server configurations. Maybe search for "register globals" on the internet if you want more information about it.
Tony The Tiger
Bondings wrote:
The short urls only work on some server configurations. Maybe search for "register globals" on the internet if you want more information about it.


I found something decent at http://www.ineasysteps.com/updates/PHP_Form_Variables.pdf .
Related topics
PHP Tutorials
LOOKING FOR THE SERVICES OF WEBSITE DESIGNERS
HTML + PHP problem
Server down?
Remember form Data HTML
"Forms To Go" create scripts in PHP, ASP and Perl
html width problem [solved by myself :) ]
Building Web Forms In Flash
ASP codings to get the contents from html forms?
Html Forms help please?
PHP noob problem
HTML Validation Problem
Form Proccessors easier than mailto command?
HTML Layout Problem whith variouse Browsers
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.