The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
problems iterating in RUBY while extracting info from YAML, Pls help! wrapster High Level Programming 1 10-05-2008 03:38 PM
Extracting information from text fields. spindoctor UNIX for Dummies Questions & Answers 24 06-09-2007 02:17 PM
Extracting information from a template Ernst Shell Programming and Scripting 4 03-07-2007 01:18 AM
extracting from tar.bz2 Raom UNIX for Advanced & Expert Users 1 03-07-2006 10:33 AM
'make' problems (compliation problems?) xyyz UNIX for Advanced & Expert Users 5 11-05-2001 10:47 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-17-2008
c0mrade c0mrade is offline
Registered User
  
 

Join Date: May 2008
Posts: 35
Problems with extracting information

Hi all,

PHP Code:
<select name="comp" id="comp" style="width:130px;">
    <?php $sqlcomp mysql_query("SELECT * FROM comp");
      while (
$redcomp mysql_fetch_array($sqlcomp)) {
      
extract($redcomp);
         echo 
"<option value=\"$comp_id\">comp_name</option>";
    
    }
    
?>
        
                        </select>
My question is following, I have $_SESSION['comp_id'] equals some value, now I'd like to make 1st option in the list the one I'm having stored in session.

Ex :

Results from database are :
comp_id comp_name
1 comp1
2 comp2
3 comp3

and in session I have stored $_SESSION['comp_id'] equals 2 ; now I'd like to get the following result in html from php :
[code=text]
<select name="comp" id="comp" style="width:130px;">
<option value="2">comp2</option>
<option value="1">comp1</option>
<option value="3">comp3</option>
</select>
[/code]
OR
[code=text]
<select name="comp" id="comp" style="width:130px;">
<option value="2">comp2</option>
<option value="3">comp1</option>
<option value="1">comp3</option>
</select>
[/code]
it really doesn't matter as long as item from session is located 1st on the list. Thank you and I apologize for my bad English.
Closed Thread

Bookmarks

Tags
unresolved, unresolved for months, unresolved for weeks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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

BB 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 -4. The time now is 02:08 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0