Have an option menu that is driving me crazy.
<?PHP
$text=($_POST['selGrade']);
echo (!empty($text) ? $text : "ALL");
?>
The menu is fed by a table that is set to % to show all records on page load. On load the page shows "Notice: Undefined index: selGrade in..."
Selecting an option will echo correctly. Selecting All records from the option Menu will echo "%".
Here is my option menu:
<form id="formGrade" name="formGrade" method="post" action="#Grade">
Filter by grade level: <strong>
<select name="selGrade" id="selGrade"
onchange="formGrade.submit()">
<option value="%">all grade levels</option>
<?php
do {
?>
<option value="<?php echo $row_RecordsetGrade['Grade']?>"<?php
if ($varGrade_Recordset15 == $row_RecordsetGrade['Grade']) {echo 'selected';} ?>>
<?php echo $row_RecordsetGrade['Grade']?></option>
<?php
} while ($row_RecordsetGrade = mysql_fetch_assoc($RecordsetGrade));
$rows = mysql_num_rows($RecordsetGrade);
if($rows > 0) {
mysql_data_seek($RecordsetGrade, 0);
$row_RecordsetGrade = mysql_fetch_assoc($RecordsetGrade);
}
?>
</select>
</strong><a href="course_types.php">reset</a>
</form>
I just want it to echo the option menu selected. All grades (which is the default should echo "ALL" and everything else seems to be working fine. Problem seems to be the onload and when selecting All Records again. Any suggestions?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…