Problem with indexes on drop down
Posted: Mon Apr 02, 2007 9:47 am
Hi,
I have a script that generates html based on certain conditions being met, one of the types is a drop down list. I have been given this script below to generate the drop down, but the problem I am having relates to undefined indexes as indicated below:
When I enter a value in the drop down and hit submiot the page returns with these errors gone, I therefore tried to use isset on post but this then did not display the html above because nothing is intially set.
Any ideas?
Thanks,
G
I have a script that generates html based on certain conditions being met, one of the types is a drop down list. I have been given this script below to generate the drop down, but the problem I am having relates to undefined indexes as indicated below:
Code: Select all
$display .= "Please select rate type:"; **** Undefined index on '$display'
$display .= '<select size="1" name="test">';
foreach(array('Approximate Charge', 'Per Hour') as $value)
{
$selected = ($_POST['test'] == $value) ? ' selected="selected"' : ''; **** undefined index on 'test'
$display .= "<option value='$value'$selected>$value</option>\n";
}
$display .= '</select>';
echo $display;Any ideas?
Thanks,
G