将可选择的空白字段添加到php表单

I have a Ticket Edit table on my website and I have a row called 'Staff' in the table. I want to add a blank filed to this drop down row and anyone can select it as blank.

this is my php code of the row:

<tr><td>Staff</td><td><select name='call_staff'>
<?php $staff_name = $db->get_results("select user_id,user_name from site_users where user_level<>1 order by user_name;");

foreach ($staff_name as $staff )
{?>

<option value='<?php echo $staff->user_id;?>'<?php if($staff->user_id == $call_staff){echo ' selected';}?>><?php echo $staff->user_name;?></option>
<?php } ?>
</select></td></tr>

when someone wants to select the staff , this only have the values that are already in database such as John or Kitty or else . but i want to add a field which is blank and selectable.

just add a extra option tag after your select tag

<tr><td>Staff</td><td><select name='call_staff'>
<option value="0"></option>
<?php $staff_name = $db->get_results("select user_id,user_name from site_users where user_level<>1 order by user_name;");

foreach ($staff_name as $staff )
{?>

<option value='<?php echo $staff->user_id;?>'<?php if($staff->user_id == $call_staff){echo ' selected';}?>><?php echo $staff->user_name;?>
</option>
<?php } ?>

After:

<select name='call_staff'>

You can simply add the following simple html code:

<option value="none"></option>
  • It's another select-able option
  • It's blank but still has a value (for a possible later use in your php code)