473,327 Members | 2,103 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Sending drop down menu selection to another page

Here is what I have done:
Created a page with a drop down menu listing names of builders retrieved from a mysql database containing contact info for client builders.
What I need to do, and so far have been stumped, is this:
When a builder name is selected from the drop down, I need to have the selected builders record, (name, address, etc) listed in a table on another page.
The new page would be called viewbuilder.php

Will someone PLEASE help me with the code to accomplish this??
Here is the code for the page having the drop down menu. As you can see I am using Dreamweaver.

Expand|Select|Wrap|Line Numbers
  1. <?php require_once('Connections/btest.php'); ?>
  2. <?php
  3. mysql_select_db($database_btest, $btest);
  4. $query_Recordset1 = "SELECT * FROM builder ORDER BY bname ASC";
  5. $Recordset1 = mysql_query($query_Recordset1, $btest) or die(mysql_error());
  6. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  7. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  8. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  9. <html xmlns="http://www.w3.org/1999/xhtml">
  10. <head>
  11. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  12. <title>Untitled Document</title>
  13. </head>
  14.  
  15. <body>
  16. <form id="form1" name="form1" method="post" action="">
  17.   builder
  18.     <select name="select">
  19.       <option value="?">-Please Select-</option>
  20.       <?php
  21. do {  
  22. ?>
  23.       <option value="<?php echo $row_Recordset1['bname']?>"><?php echo $row_Recordset1['bname']?></option>
  24.       <?php
  25. } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
  26.   $rows = mysql_num_rows($Recordset1);
  27.   if($rows > 0) {
  28.       mysql_data_seek($Recordset1, 0);
  29.       $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  30.   }
  31. ?>
  32.   </select>
  33. </form>
  34. </body>
  35. </html>
  36. <?php
  37. mysql_free_result($Recordset1);
  38. ?>
  39.  
Jul 14 '07 #1
4 2930
Sorry. I had forgotten to add a submit button.
This is the code with the submit button added.

Expand|Select|Wrap|Line Numbers
  1. <?php require_once('Connections/btest.php'); ?>
  2. <?php
  3. mysql_select_db($database_btest, $btest);
  4. $query_Recordset1 = "SELECT * FROM builder ORDER BY bname ASC";
  5. $Recordset1 = mysql_query($query_Recordset1, $btest) or die(mysql_error());
  6. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  7. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  8. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  9. <html xmlns="http://www.w3.org/1999/xhtml">
  10. <head>
  11. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  12. <title>Untitled Document</title>
  13. </head>
  14.  
  15. <body>
  16. <form id="form1" name="form1" method="post" action="">
  17.   builder
  18.     <select name="select">
  19.       <option value="?">-Please Select-</option>
  20.       <?php
  21. do {  
  22. ?>
  23.       <option value="<?php echo $row_Recordset1['bname']?>"><?php echo $row_Recordset1['bname']?></option>
  24.       <?php
  25. } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
  26.   $rows = mysql_num_rows($Recordset1);
  27.   if($rows > 0) {
  28.       mysql_data_seek($Recordset1, 0);
  29.       $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  30.   }
  31. ?>
  32.   </select>
  33.     submit
  34.     <input type="submit" name="Submit" value="Submit" />
  35. </form>
  36. </body>
  37. </html>
  38. <?php
  39. mysql_free_result($Recordset1);
  40. ?>
  41.  
Jul 14 '07 #2
Atli
5,058 Expert 4TB
Hi, cctxman1942, and welcome to TSDN!

What I would do, is not send all the info from the 'select' page to the 'display' page. I would just send the ID of the data I wanted displayed, and then retreive the data from the database when I want to display it.
Jul 15 '07 #3
Hi, cctxman1942, and welcome to TSDN!

What I would do, is not send all the info from the 'select' page to the 'display' page. I would just send the ID of the data I wanted displayed, and then retreive the data from the database when I want to display it.

Thank you, Atli for your response.
Please accept my apology for my ignorance, but how do you do that?
Thanks again.
Jul 15 '07 #4
code green
1,726 Expert 1GB
Well you need a database for a start
Jul 18 '07 #5

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

Similar topics

1
by: Greg Scharlemann | last post by:
I would like to automatically populate a drop down menu when the page loads based on the selection of an item in a different drop down menu. I made a test page that when drop down #1 changes, drop...
11
by: Dan | last post by:
Hello all, I am getting records from a db and displaying the records to the user through a drop down menu in an asp page. Each record has 6 fields and I need to display them all to the user in...
1
by: Steve JORDI | last post by:
Hi, I'd like to know whether there is a class or some code sample available somewhere to do what I'd like to achieve. I have two drop down menus next to each other. The first one has its...
1
by: bvlmv | last post by:
Hello, relatively new to programming and just trying to create a simple asp page. I have the following drop down menu on a html page and when submitting i would like to call out on asp what someone...
6
by: bvlmv | last post by:
Hello, relatively new to programming and just trying to create a simple asp page. I have the following drop down menu on a html page and when submitting i would like to call out on asp what...
2
by: ponyeyes | last post by:
Hi There, I am a bit of a newbie to PHP programming and I would like to know how I can place a selected drop down option into a PHP variable and then produce an sql query which incorporates this...
4
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me...
1
by: sparksol | last post by:
I have a form with a drop down box. If you select an option in the drop down box (depending which option is selected) one or two textbox(es) and a submit button display. I would like to keep the...
6
by: phpnewbie26 | last post by:
My current form has one multiple select drop down menu as well as few other drop down menus that are single select. Originally I had it so that the multiple select menu was first, but this created...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.