473,404 Members | 2,187 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,404 software developers and data experts.

Display data from same table via drop down on one column

4
Hi,

I have a table with the following columns.
code, class, nobeds, bedtype, sleeps

I have made column "code" into a select list and am trying to figure a way to join it to the other columns but to keep them invisible until a selection is made from the select list. Once a selection has been made then the remaining column's data is made visible alongside the select list and concatenated into a comma separated single field for information purposes only to the user. Once the form is submitted then the selected item i.e. the "code": column only data is submitted to a different table as the other columns purely describe what the "code" column is all about.
Am using Dreamweaver MX2004 but they don't seem to have any solution to this other than displaying the whole table at once which I don't want to do.

Any ideas anyone as I have searched for this solution everywhere

rgds
Jul 3 '07 #1
6 2329
kovik
1,044 Expert 1GB
If you want them hidden until a selection is made, you'll need display them ALL, then hide/display them with JavaScript or retrieve them using AJAX.

If you want to make a selection, and then submit and then show the data, you'd have PHP display it upon submission.
Jul 3 '07 #2
garwil
4
Hi,
Thanks fore the reply. This is all new to me so I wull ahve to find something in Java that can do it..
Jul 3 '07 #3
Motoma
3,237 Expert 2GB
I have moved this thread to the Javascript forum, where I am sure you will find more help with this problem.
Jul 3 '07 #4
garwil
4
great thanks for all the help so far
Jul 3 '07 #5
ak1dnar
1,584 Expert 1GB
garwil,
Could you Please show us the coding here.
Jul 4 '07 #6
garwil
4
Hi, Thanks for the reply.

Since my last post I have changed things a bit and guess what? I am still in the dark.

I split the one table into two, thinking I could use a dynamic dependant drop down by selecting the item's code in the first drop down and just viewing the concatentated explanation for that code in the second as a way around my problem There 219 items in the table.

Expand|Select|Wrap|Line Numbers
  1. <?php require_once('../Connections/link.php'); ?>
  2. <?php
  3. $maxRows_roomtypes = 10;
  4. $pageNum_roomtypes = 0;
  5. if (isset($_GET['pageNum_roomtypes'])) {
  6.   $pageNum_roomtypes = $_GET['pageNum_roomtypes'];
  7. }
  8. $startRow_roomtypes = $pageNum_roomtypes * $maxRows_roomtypes;
  9.  
  10. mysql_select_db($database_link, $link);
  11. $query_roomtypes = "SELECT * FROM roomtypes";
  12. $query_limit_roomtypes = sprintf("%s LIMIT %d, %d", $query_roomtypes, $startRow_roomtypes, $maxRows_roomtypes);
  13. $roomtypes = mysql_query($query_limit_roomtypes, $link) or die(mysql_error());
  14. $row_roomtypes = mysql_fetch_assoc($roomtypes);
  15.  
  16. if (isset($_GET['totalRows_roomtypes'])) {
  17.   $totalRows_roomtypes = $_GET['totalRows_roomtypes'];
  18. } else {
  19.   $all_roomtypes = mysql_query($query_roomtypes);
  20.   $totalRows_roomtypes = mysql_num_rows($all_roomtypes);
  21. }
  22. $totalPages_roomtypes = ceil($totalRows_roomtypes/$maxRows_roomtypes)-1;
  23.  
  24. $maxRows_roomtypecodes = 10;
  25. $pageNum_roomtypecodes = 0;
  26. if (isset($_GET['pageNum_roomtypecodes'])) {
  27.   $pageNum_roomtypecodes = $_GET['pageNum_roomtypecodes'];
  28. }
  29. $startRow_roomtypecodes = $pageNum_roomtypecodes * $maxRows_roomtypecodes;
  30.  
  31. mysql_select_db($database_link, $link);
  32. $query_roomtypecodes = "SELECT * FROM roomtypecodes";
  33. $query_limit_roomtypecodes = sprintf("%s LIMIT %d, %d", $query_roomtypecodes, $startRow_roomtypecodes, $maxRows_roomtypecodes);
  34. $roomtypecodes = mysql_query($query_limit_roomtypecodes, $link) or die(mysql_error());
  35. $row_roomtypecodes = mysql_fetch_assoc($roomtypecodes);
  36.  
  37. if (isset($_GET['totalRows_roomtypecodes'])) {
  38.   $totalRows_roomtypecodes = $_GET['totalRows_roomtypecodes'];
  39. } else {
  40.   $all_roomtypecodes = mysql_query($query_roomtypecodes);
  41.   $totalRows_roomtypecodes = mysql_num_rows($all_roomtypecodes);
  42. }
  43. $totalPages_roomtypecodes = ceil($totalRows_roomtypecodes/$maxRows_roomtypecodes)-1;
  44. ?>
  45. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  46. <html>
  47. <head>
  48. <title>Untitled Document</title>
  49. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  50. </head>
  51.  
  52. <body>
  53. <form name="form1" method="post" action="">
  54.   <table border="1">
  55.     <tr>
  56.       <td>roomtypecodeid</td>
  57.       <td>class</td>
  58.       <td>nobeds</td>
  59.       <td>bedtype</td>
  60.       <td>sleeps</td>
  61.     </tr>
  62.     <?php do { ?>
  63.     <tr>
  64.       <td><?php echo $row_roomtypes['roomtypecodeid']; ?></td>
  65.       <td><?php echo $row_roomtypes['class']; ?></td>
  66.       <td><?php echo $row_roomtypes['nobeds']; ?></td>
  67.       <td><?php echo $row_roomtypes['bedtype']; ?></td>
  68.       <td><?php echo $row_roomtypes['sleeps']; ?></td>
  69.     </tr>
  70.     <?php } while ($row_roomtypes = mysql_fetch_assoc($roomtypes)); ?>
  71.   </table>
  72.   <p>&nbsp;</p>
  73.   <table border="1">
  74.     <tr>
  75.       <td>id</td>
  76.       <td>code</td>
  77.     </tr>
  78.     <?php do { ?>
  79.     <tr>
  80.       <td><?php echo $row_roomtypecodes['id']; ?></td>
  81.       <td><?php echo $row_roomtypecodes['code']; ?></td>
  82.     </tr>
  83.     <?php } while ($row_roomtypecodes = mysql_fetch_assoc($roomtypecodes)); ?>
  84.   </table>
  85.   <p>&nbsp;</p>
  86. </form>
  87. </body>
  88. </html>
  89. <?php
  90. mysql_free_result($roomtypes);
  91.  
  92. mysql_free_result($roomtypecodes);
  93. ?>
  94.  
The above code is just one item I am displayiong in a much larger form to be submitted.
BAsically the user has to set up their rates to hire out rooms for and part of the process is to select a type of room to be associated with what we call a "system rate type" The COLUMN "CODE" in the second table called ROOMTYPECODES looks like this "A1D/2" and the details in the second table called ROOMTYPE(in fact the top one in the example above but they will be changed around later) are in another table which consists of the following fields
roomtypecodeid ,class, nobeds, bedtype, sleeps . All I want to do is to select the ROOMTYPE CODE from a select list and have the details associated with that code displayed to the user so they know what the code consists of like so:

A1D/2 - (field_class =Superior) (field_nobeds =1) (field_bedtype= Double and field_sleeps= 2 ) . ((Field_xxx = ))will not be visible besides the table heading so what the user sees when they click on "A1D/2" etc on the select list will be

A1D/2 - Superior Room, 1 Double Bed, Sleeps 2

Hope this all makes sense

best regards

garwil
Jul 4 '07 #7

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

Similar topics

1
by: SABmore | last post by:
I have the following code that populates 3 independent drop-down boxes with data from arrays. From there the user can select a value from a drop-down list, or input data into a text box. The user...
1
by: Rich | last post by:
I have a form with a combo box on it. The combo box's source is a access lookup table with two columns, EmployeeName & EmployeeNumber. I want to display the EmployeeName from the dropdown but...
1
by: atif | last post by:
hi i hav a prob with data reader. i hav a 2 column in a data table n i hav 2 drop down lists on my page. Now i want to connect my first drop down with the first column of the data table. Though i...
1
by: vasilip | last post by:
I'm testing out db2 for a project I'm starting that requires proper xml support and I can't seem to get both xml and spatial data to work well in the same table. Once having created a table...
4
by: rszebras | last post by:
I inherited a database (as a novice at Access) and need to modify it to make it more efficient, i.e., the assignment form needs to autopopulate with the client's name, address, phone number, etc.,...
8
by: mlwerth | last post by:
Dear Access Group: This is the most basic and most embarrassing of questions, but I cannot find where to change the data type of a text field that I have in Access 2003 to a number field. I've...
10
by: darkenroyce | last post by:
Hi Guys I am creating a sports database and one of the features involves create drop down dialogue boxes that retrieve data from MySQL tables and provides them as <option> within...
2
by: Iain Wilson | last post by:
Hi Can anyone please advise if this is possible and if so how I would go about it (a pointer to an example would be greatly appreciated). Using C# - Web Application I have a DropDownList with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.