Re: dropdown Newbie question
| From: | timo stamm | Date: | Tue, 10 Sep 2002 19:17:55 +0000 |
| Subject: | Re: dropdown Newbie question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115882@lists.php.net to get a copy of this message | ||
Hi Mario,
you can set error_reporting to E_ALL to give you more hints to bugs and to produce clean code.
You are having two problems. The first was related to your form and has been addressed by Yasin.
The second is that you have autoglobals off. That means you have to use $_SERVER['PHP_SELF']. BTW: You could have found this error by reading about predefined variables, PHP_SELF in the manual.
Timo
Working:
<?php
echo ' <form name="test" action="'.$_SERVER['PHP_SELF'].'" method="POST"><br>
<select name="color" id="colorPicker"
onChange="changeColor(this.options[this.selectedIndex].value)">
<option>Background Color
<option value="0000FF">Blue
<option value="FF0000">Red
<option value="00FF00">Green
<option value="000000">Black
</select>
<input type="submit" value="Click To View Submission">
</form>
';
if(isset($_POST['color'])) {echo $_POST['color'];}
?>
</body>
</html>