undefine variable
| From: | Michael S. Dunsavage | Date: | Sun, 17 Aug 2008 21:05:14 +0000 |
| Subject: | undefine variable | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-278250@lists.php.net to get a copy of this message | ||
I'm having a problem running a form script. It used to work before, but
now when I submit the form an error pops up and it won't write to the
database:
This is the error:
[Sun Aug 17 16:46:54 2008] [error] [client 127.0.0.2] PHP Notice:
Undefined variable: selected_state
in /srv/www/htdocs/djtommer/contact.php on line
243
This is the code:
-------------
foreach($state_list as $key=>$value){
if($selected_state == $key){
$sel = 'selected="selected"';
}
else{
$sel = '';
}
echo "<option $sel value=\"$key\">$value</option>";
}
echo '</select>';
?>
----------
--
Michael S. Dunsavage