I have a list box that generates all the users that are in the database. I want to make it so when the submit button is clicked, the selected listbox item is stored in a variable. I'm not sure exactly what i'm doing wrong, i'm sure it's something easy that i'm overlooking
<?php
$mySQL = " SELECT nameFirst, concat(nameLast, ', ' , nameFirst) as name
from timecard.users
ORDER BY nameLast ASC, nameFirst ASC";
$rs_users = $x->ExecuteQuery("timecard", $mySQL);
echo '<form id="UserSel" name="UserSel" method="post" STYLE="margin: 0px; padding: 0px;">';
echo '<select name="'.$field.'" onChange="????????????">';
echo '<option></option>';
for($i = 0; $i < sizeof($rs_users); $i++) {
if($_POST[$field] == $rs_users[$i]['username']) {
echo '<option value="'.$rs_users[$i]['username'].'" selected>'.$rs_users[$i]['name'].'</option>';
}else{
echo '<option value="'.$rs_users[$i]['username'].'">'.$rs_users[$i]['name'].'</option>';
}
}
echo '</select>';
echo '</form>';
unset($rs_users);
}
?>
<input type="submit" name="Submit" value="Look Up" onclick="<?php print_r($_POST[????????]) ?>">