...

View Full Version : Drop-Down Get Return From Default



jayson.ph
07-11-2012, 03:27 AM
Hi All,

i just ask why? when i select record from the drop-down-list it will return to a default netbook. see image below

http://i50.tinypic.com/2j2uvbn.png

as you notice i select category and it success to change from the address bar. but i wonder why in the circle portion it return to a default netbook. here my code.


var val=form.cat.options[form.cat.options.selectedIndex].value;
self.location='insert_request.php?cat=' + val ;


$query = "SELECT DISTINCT cat_name,cat_it FROM tbl_category";
$x = mysql_query($query);

echo "<p>Category:<select name ='cat' onchange=\"reload(this.form)\">";
while($v = mysql_fetch_array($x))
{
if($v['cat_name'])
{
echo "<option value = $v[cat_name]> $v[cat_name]</option>";
}

}
echo "</select></p>";

firepages
07-11-2012, 08:25 AM
because you are not telling it to ...



if($v['cat_name']) {
$s=$v['cat_name']==$_GET['cat'] ? 'selected="SELECTED" ' : '' ;
echo "<option $s value =\"{$v['cat_name']}\"> {$v['cat_name']}</option>";
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum