TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   <select> a chosen row from tabel (http://www.talkphp.com/general/2147-select-chosen-row-tabel.html)

lesP 01-30-2008 10:17 PM

<select> a chosen row from tabel
 
Hello!
My scripts should <selected> the row from the table where spil='$_REQUEST["spil"] and then show the rest of the rows beneath, but it just <selected> the same row every time. Please help!

PHP Code:

while($result=mysql_fetch_array($query)){
     
$id_hold_array=$result["titel"];
     
$arrayid=$result["id"];

     if(isset(
$_REQUEST["spil"]) && $_REQUEST["spil"]==$result["id"]){
           echo 
'<option value="index.php?mode=mine_spil&action=index&spil='.$arrayid.'" selected>'.$id_hold_array.'</option>';


      } else {
    echo 
'<option value="index.php?mode=mine_spil&action=index&spil='.$arrayid.'">'.$id_hold_array.'</option>';
      }



   } 


wGEric 01-30-2008 10:31 PM

echo out the two variables in your if statement to see what's going on. Make sure they are what you think they should be.

xenon 01-30-2008 11:00 PM

Also, the correct tag with the selected attribute looks so:

Code:

<option value="some value" selected="selected">text to show</option>
But this is more like a notice, it doesn't affect your script in any way.


All times are GMT. The time now is 10:11 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0