Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function WriteData($start, $end, $label, $name, $array, $default = 'choose')
- {
- echo <<< W1
- <label for="$name">$label</label>
- <select name="$name" id="$name">
- <option value="choose">choose</option>
- W1;
- for(;$start<$end;$start++)
- {
- $number = $start ;
- if($start==$default)
- {
- echo '<option value="'.$number.'">'.$start.'</option>';
- }
- else
- {
- echo '<option value="'.$number.'">'.$start.'</option>';
- }
- }
- if($array[$start] === $default)
- {
- echo '<option value="'.$array[$start].' selected">'.$array[$start].'</option>';
- }
- else
- {
- echo '<option value="'.$array[$start].'">'.$array[$start].'</option>';
- }
- echo "</select>";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement