Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Selecting Variable in a List box
Old 02-22-2008, 10:54 AM Selecting Variable in a List box
Junior Talker

Posts: 1
Trades: 0
I am using php and sql to search through a database and list certain details from a table. When the details are found i am trying to...on click, show all the remaining details from the table, as the variable in the list box is the primary key.
PHP Code:
$query=mysql_query("SELECT `Request ID` FROM Requests");
while (
$row=mysql_fetch_array($query)) {
        
$reqID $row['Request ID'];
        
$reqIDoptions .= "<OPTION VALUE=\"$reqID\">" $reqID
this shows part of the code i am using to show the primary key from the table into the list box.

HTML Code:
<SELECT NAME="reqID">
  <OPTION VALUE=0>
    <?=$reqIDoptions?>
    </option>
this is showing the declaration in html of the list box itself. I am only asking how to select the value from the table, and store it in a variable, from there i should be able to work the rest out.
khy86 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-25-2008, 11:05 AM Re: Selecting Variable in a List box
Arenlor's Avatar
Ultra Talker

Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
So what exactly are you trying to do? If you're trying to dynamicaly load a dropdown box then you're nowhere near it, can you make it more clear what you're trying to do, because your code is highly screwed up and is FUBAR really.
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 02-26-2008, 02:18 AM Re: Selecting Variable in a List box
jito's Avatar
MY LIFE IS 'i' LIFE

Posts: 565
Name: surajit ray
Location: inside the heart of my friends
Trades: 0
<OPTION VALUE=0>
You must store it in the value property , and not in the level
__________________
I am not smart, that's why i don't act smart


Please login or register to view this content. Registration is FREE
jito is offline
Reply With Quote
View Public Profile
 
Old 02-26-2008, 02:29 PM Re: Selecting Variable in a List box
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I don't know if the code is incomplete on purpose, but try this:
PHP Code:
while ($row=mysql_fetch_array($query)) {
        
$reqID $row['Request ID'];
        
$reqIDoptions .= "<OPTION VALUE=\"$reqID\">" $reqID ."</option>";

and
HTML Code:
<SELECT NAME="reqID">
    <?=$reqIDoptions?>
</select>
Understand that you have a select element, and each line in the drop down is 1 option.
It's not 1 option that contains every possible values.
__________________
Only a biker knows why a dog sticks his head out the window.

Last edited by tripy; 02-26-2008 at 02:31 PM..
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to Selecting Variable in a List box
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19787 seconds with 12 queries