View Single Post
  #9  
Old 01-12-2009, 09:46 AM
 
AMMoyer AMMoyer is offline
 

Senior Member
  
Join Date: Nov 2008
Posts: 150
 

Default Re: Retaining selected Item in dropdown menu

Thank you Victor!!!

One last question on this subject. The years are working great and then the Makes are loading properly, but I am having trouble getting the Make to "stick" in the dropdown box also. I'm sure there is something mis-named or there's an issue with the {if} statement, but I've been staring at it too long to find it. Thanks again.

Partial TPL code:
Code:
<select name="make" style="width: 90%;" onchange="javascript:document.mmysearchform.submit ();"{if $year == ''} disabled="disabled"{/if}> <option value="" selected="selected">Select Make</option> {foreach item=make from=$makes} <option value="{$make.makeid}"{if $make.makeid == $make} selected="selected"{/if}>{$make.makename}</option> {/foreach} </select><br>

Partial PHP code:
Code:
$year = $_POST['year']; if ($year){ $query2 = sprintf("SELECT DISTINCT makeid, makename FROM iemmy WHERE yearid='$year'"); $result2 = @mysql_query($query2); while ($makerow = mysql_fetch_assoc($result2)) { $makelist['makeid'] = $makerow['makeid']; $makelist['makename'] = $makerow['makename']; $makes[] = $makelist; } } $smarty->assign("makes", $makes);
__________________
Adam
X-Cart Gold 4.4.5 - Live
X-Cart Gold 4.1.11 - Retired
X-Payments 1.0.4
CDSEO Pro
EWD Hosting
Reply With Quote