Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Array with the full times list */
- $startTimes = array();
- /* Array with the already used times */
- $arr = array();
- /* This is the select HTML code */
- $select = '<select name="mySelectName">';
- /* Now, we build the options list */
- foreach ($startTimes as $time)
- {
- $select .= '<option value="' . htmlspecialchars($time) . '"';
- /* Disable the option if the time is used */
- if (in_array($time, $arr))
- {
- $select .= ' disabled="disabled"';
- }
- $select .= '>' . htmlspecialchars($time) . '</option>';
- }
- $select .= '</select>';
- echo $select;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement