Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Drop-Down Get Return From Default

    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



    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.

    PHP Code:
    var val=form.cat.options[form.cat.options.selectedIndex].value;
    self.location='insert_request.php?cat=' val 
    PHP Code:
     $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>"

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,095
    Thanks
    11
    Thanked 101 Times in 99 Posts
    because you are not telling it to ...

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

    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •