i have seen several question but i can not find any answer? i am add a some value to dropdown through the loop and want to show the value when i select one value from dropdown box .but i can not find .
$items[] = $file ;
echo '<select name="value">';
foreach($items as $video){
echo '<option value="' . $video . '">' . $video . '</option>' ;
}
echo '</select>';
$value = $_GET['footage'];
How can I get the value when I select some value in the dropdown box.
You need to add HTML selected
attribute to <select>
$value = $_GET['footage']; /* typo*/
$items[] = $file ;
echo '<select name="value">';
foreach($items as $video){
$selected = ($value == $video) ? 'selected="selected"' : '';
echo '<option value="' . $video . '"' . $selected . '>' . $video . '</option>' ;
}
echo'</select>';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.