Undefined Index If I Do Not Check Checkbox
I seem to have a bizaar happening here. If I check a checkbox on the form
then the php script runs perfectly. If I don't check the box php reports
an undefined index on another variable.
That's using IIS localhost, checking things.
On the web the published identical script works no matter what. Well,
virtually identical. I have locally added a variable 'test' POST-ed to php
and compared with a hard coded value. That's all.
Here's the html for the checkbox:
<tr>
<td>Publish Comment?</td>
<td><input name="publishok" value="NO" type="checkbox"> Check Box For Do
spanstyle="font-weight: bold;">Not</span> Publish</td>
</tr>
<tr>
and here's the php for the variable, 'publishok' :
$IP = $_SERVER["REMOTE_ADDR"];
$publishok = $_POST['publishok'];
$test = $_POST['test'];
if ($test != 'park') die ("Wrong input. Sorry. Go back, try again");
I suspected my editor PSPad was adding spurious (and invisible) char codes
or something so I upgraded to the latest version. No difference.
Can't think what could cause this.
Can anyone help?
No comments:
Post a Comment