<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 My Data!">
</form>
</body>
</html>
<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>
when i input two value and hit my button i get the folloing output:
Hi
You like the word !?!
You oughta be ashamed of yourself!
Why doesnot it print my name and the word i type in my favorite field? why it looks like" !?! " ??
Why dont i get the desired output from this peice of code?
Moderator: General Moderators
Okay, chances are you have register globals off. If you do have them off, you will probably want to keep them off.
Try changing the following two fragments from this:
To this:
Try changing the following two fragments from this:
Code: Select all
<?php print $YourName; ?>Code: Select all
<?php print $FavoriteWord; ?>Code: Select all
<?php print $_POST['YourName']; ?>Code: Select all
<?php print $_POST['FavoriteWord']; ?>-
crazytopu
- Forum Contributor
- Posts: 259
- Joined: Fri Nov 07, 2003 12:43 pm
- Location: London, UK
- Contact:
Yah my global register is off. when i write the following code it gives me an output:
<?php
echo '<pre>';
echo 'PHP Version: '.phpversion()."\n";
echo 'Display Errors: '.(ini_get('display_errors') == '1' ? 'On' : 'Off')."\n";
echo 'Error Level: '.(ini_get('error_reporting') == '2047' ? 'E_ALL' : 'Not E_ALL')."\n";
echo 'Register Globals: '.(ini_get('register_globals') == '' ? 'Off' : 'On')."\n";
echo '</pre>';
?>
output:
PHP Version: 4.3.4
Display Errors: On
Error Level: Not E_ALL
Register Globals: Off
I just dont know what's the difference between leaving it off or on. How can i change its status - from off to on?
and thanks nigma. it worked when i used ur code.
<?php
echo '<pre>';
echo 'PHP Version: '.phpversion()."\n";
echo 'Display Errors: '.(ini_get('display_errors') == '1' ? 'On' : 'Off')."\n";
echo 'Error Level: '.(ini_get('error_reporting') == '2047' ? 'E_ALL' : 'Not E_ALL')."\n";
echo 'Register Globals: '.(ini_get('register_globals') == '' ? 'Off' : 'On')."\n";
echo '</pre>';
?>
output:
PHP Version: 4.3.4
Display Errors: On
Error Level: Not E_ALL
Register Globals: Off
I just dont know what's the difference between leaving it off or on. How can i change its status - from off to on?
and thanks nigma. it worked when i used ur code.