473,467 Members | 2,224 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

trying to pass multiple row entries through a single select list.

1 New Member
I'm fairly new to php. I am trying to get my php to send multiple fields from a database record row from a single drop down box selection. I can pass my image name"imgName", and I'd also like to be able to pass a pdf file name "pdfName" as well.
Here is my select code:

Expand|Select|Wrap|Line Numbers
  1. <select name="imgName" onChange="chkFrm(this)">
  2.                         <option value="" <?php if (!(strcmp("Choose", $_POST['imgName']))) {echo "selected";} ?>>Choose Proof Image</option>
  3.                         <?php
  4.  
  5.       do {
  6. ?>
  7.                         <option value="<?php echo $row_proofImages['imgName']?>"<?php if (!(strcmp($row_proofImages['id'], $_POST['imgName']))) {echo "selected";} ?>><?php echo $row_proofImages['imgName']?></option>
  8.                         <?php
  9. } while ($row_proofImages = mysql_fetch_assoc($proofImages));
  10.   $rows = mysql_num_rows($proofImages);
  11.   if($rows > 0) {
  12.       mysql_data_seek($proofImages, 0);
  13.       $row_proofImages = mysql_fetch_assoc($proofImages);
  14.   }
  15. ?>
  16.                       </select>
  17.  
  18.  
Jul 18 '12 #1
3 2531
Exequiel
288 Contributor
Expand|Select|Wrap|Line Numbers
  1. <select name="imgName" onChange="chkFrm(this)">
  2.                     <?php
  3.                     $id=$_GET['id'];
  4.                         $query=mysql_query("Select * from tbl_images where id_name='$id'");
  5.                             while($que=mysql_fetch_array($query))
  6.                             {
  7.                                 echo '<option value="'.$que['imgName'].'"> '.$que['imgName'].'</option>';
  8.                             }    
  9.                     ?>
  10.  
  11.                 </select>    
  12.  
This code is a sample on how to view records came from database to select tag....
Jul 19 '12 #2
programDragon
2 New Member
What you might try is passing the variables with a char to separate them.
Expand|Select|Wrap|Line Numbers
  1. <select name="varPass" onChange="chkFrm(this)">
  2. <option value="<?php echo imgName . ':' . pdfName;?>"Choose Proof Image</option>
Then in the processing page just split the variables by the ':'.
Jul 23 '12 #3
Rabbit
12,516 Recognized Expert Moderator MVP
The normal operating procedure is to pass a unique key. Display it however you want in the select list, but pass the unique key. Then, when you need the rest of the information, you retrieve it by the key.
Jul 23 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: cwwilly | last post by:
Hello, Thanks for taking a look at this! Problem: I'm trying to pass multiple dynamic values between a slaveform and a masterform. The problem I'm having is on the slaveform I loop through...
3
by: d.schulz81 | last post by:
Hi all how can i manipulate a multiple select into a single select dropdown field with JavaScript? thanks
19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
1
by: ccr | last post by:
Please view in a text editor so that the columnar text lines up. I used Terminal 9pt font to compose this post and copied/pasted to my newsreader program. I am writing in the hope that one of...
1
by: ccr | last post by:
Reposted with a longer line length. Apologies if I did not cancel the 1st attempt before you got it. If necessary, please view in a text editor so the columnar text lines up. I used Terminal...
3
by: Usenet | last post by:
Hi there, I am quite a novice to MS Access, and I would deeply appreciate help on the following: I have created a list box in a form. I wish for that list box to enter multiple values from table...
0
by: rayone | last post by:
Hi folks. I need advice. 2 options, which do you think is the better option to display/retrieve/report on the data. Keep in mind reporting (Crystal), SQL Performance, VB Code, usability,...
5
by: carrajo | last post by:
Hey, I'm trying to duplicate the following: Select List 1 --- Apple Orange Banana
3
by: Bernard Lebel | last post by:
Hello, Is there an option or a way to allow the selection of multiple entries in the Listbox widget? I could not find any, and would like to allow the end user to select multiple entries. ...
8
by: Kasghost | last post by:
I am trying to create a DB in Access 2007 where the values in certain fields requires multiple entries. I would like to send this DB out as an HTML to my techs and have them fill the information...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.