TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-30-2008, 10:17 PM   #1 (permalink)
The Contributor
Newcomer 
 
Join Date: Jan 2008
Posts: 27
Thanks: 1
lesP is on a distinguished road
Default <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>';
      }



   } 
lesP is offline  
Reply With Quote
Old 01-30-2008, 10:31 PM   #2 (permalink)
The Acquainted
 
wGEric's Avatar
 
Join Date: Nov 2007
Posts: 166
Thanks: 0
wGEric is on a distinguished road
Default

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.
__________________
Eric

Last edited by wGEric : 01-31-2008 at 07:38 PM.
wGEric is offline  
Reply With Quote
Old 01-30-2008, 11:00 PM   #3 (permalink)
The Frequenter
Newcomer 
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default

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.
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 03:58 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design