Greetings, I have a small problem. I am trying to set a default for a dropdown menu on a page where people edit their profiles. Here is the code I have, which is not working: <select name="status" value="<?php echo $oldstatus; ?>" > <option value=""></option> <option value="Away">Away</option> <option value="Online">Online</option> <option value="Offline">Offline</option> </select> PHP: I would like the old status to be displayed so the person doesn't have to reselect a status. Please let me know if you can figure this out. Thank yo
Nevermind, I got it. I have to apologize. I sit here for 3 hours trying to figure this out, then as soon as I create a new thread here, I figure it out seconds later... sorry
<tr> <td>Status: </td> <td><select name="Status"> <option value="online" <?php if($_REQUEST['Status']=='online') echo "selected='selected'";?>>online</option> <option value="offline" <?php if($_REQUEST['State']=='offline') echo "selected='selected'";?>> offline</option> <option value="busy" <?php if($_REQUEST['State']=='busy') echo "selected='selected'";?>> busy</option> </select> </td> </tr>
<select name="status" value="<?php echo $oldstatus; ?>" > <option value=""></option> <option value="Away">Away</option> <option value="Online">Online</option> <option value="Offline">Offline</option> </select>
hello first of all ill tell you this The <select> tag is used to create a select list (drop-down list). The <option> tags inside the select element define the available options in the list. example : <select> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </select> try it
dear you can check this code you can try <select name="vehicle" value="<?php echo $oldstatus; ?>" > <option value=""></option> <option value="hero honda">hero honda</option> <option value="Pulsur">Pulsur</option> <option value="Honda">Honda</option> </select>
Dear please try this code.. i have to done with this code. <select id="status" name="status" value="<?php echo $oldstatus; ?>"> <option value=""></option> <?php /* Type Select Query for Status and get Status ID from Get value and from Query */ foreach($my_status as $key=>$val){ ?> <option value="<?=$val['status_id']?>" <?php echo ($my_status_id[0]['status_id'] == $val['status_id']) ? 'selected="selected"' : '';?>><?=$val['status']?></option> <?php } ?> </select>