-
October 31st, 2013, 07:42 AM
#1
Select List keep selected value after auto submit
Hi,
I have a select list as seen below and I want to keep the selected value after it automatically selects can anyone help please? I have tried a few things using javascript but nothing seemed to work.
Code:
<select name="inteu_06" onchange="this.form.submit()" style="margin-right:0px">
<option value="~">Price Limit - Any</option>
<?php
do {
?>
<option value="<?php echo $row_Recordset1['inteu_06']?>"><?php echo $row_Recordset1['inteu_06']?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
</select>
Many thanks
Joe
-
November 11th, 2013, 02:07 PM
#2
Re: Select List keep selected value after auto submit
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
November 11th, 2013, 02:09 PM
#3
Re: Select List keep selected value after auto submit
You need to create a selected attribute for the on that matches.
PHP Code:
<option <?php if ($_POST['inteu_06'] == $row_Recordset1['inteu_06']) {?> selected="selected"<?php } ?> value="<?php echo $row_Recordset1['inteu_06']; ?>"><?php echo $row_Recordset1['inteu_06']; ?></option>
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|