SunQuest
 
           PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old June 29th, 2004, 08:44 PM
pixelver pixelver is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 1 pixelver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
double drop down and database

Hello, I am currently working on a double dynamic drop-down and I have some difficulties to make it.

I have written the following but it does not work that’s why I’m looking for your help. I have to write it in php. In fact I have a list of course in a database like this
Code:
ID tablename course
1 bcsq      boot camp for SQ
2 bcst       …..
When a user choose a course from the first drop down we have a second drop down that appears where people can choose a date for the course.

The dates depand on the course they choose and are from a database also.
Ex:
table: bcsq
id location coursename
1 houston 14/06/2004 bcsq
2 dallas 15/07/2004

Once the choice is made I/m willing to put with a submit button the date and the name of the course in a table

Here is the code I wrote but which does not work
PHP Code:
<html>
<
head>
<
title>online registration</title>
<
meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<
meta http-equiv="Page-Enter" content="blendTrans(Duration=1.0)">
<
style type="text/css">

<!--
.
Style1 {font-family"Times New Roman"Timesserif}
.
Style2 {font-size24px}
.
Style3 {color#400080}
.Style6 {color#0000A0; font-size: 16px; }
-->

</
style>
</
head>
<
body>
<
p align="right" class="Style1">
 
<?
php
$date 
date("F j, Y, g:i a"); 
echo 
"$date"
?>
</p>
<?php
// connexion
$idConnect =mysql_connect('localhost','root','');
$db mysql_select_db("Quality Management");
// SQL request
$rqSql "SELECT * FROM menu";
// request execution
$result mysql_query$rqSql$idConnect);
$ld "<SELECT NAME='course'> ";
$ld .= "<OPTION VALUE=0>Choose a course</OPTION>";
while ( 
$row mysql_fetch_array$result)) {
       
$table $row["tablename"];
       
$coursechoose $row["course"];    
       
$ld .= "<OPTION VALUE='$coursechoose'>$table</OPTION>";
}
$ld .= "</SELECT>";
mysql_close($idConnect);
?>


<?php  
function linkone()  {
$idConnect =mysql_connect('localhost','root','');
$db mysql_select_db("Quality Management");
$rqSql1 "SELECT * FROM $coursechoose";
$result1 mysql_query$rqSql1$idConnect);
 
$newmenu "<SELECT NAME='choosendate'>";
$newmenu .= "<OPTION VALUE=0>Choose a location</OPTION>";
 
while ( 
$row1 mysql_fetch_array$result1)) {
   
       
$Location $row1["Location"];
    
$newmenu .= "<OPTION VALUE='$Location'>$Location</OPTION>";
}
$newmenu .= "</SELECT>";
mysql_close$idConnect);
print 
$newmenu;
}
?>
<form class="Style1">
<?
print $ld;
?>                               
<input type="button" value="add to selection" onChange="linkone()">
</form>
</body>
</html> 
thanks.

Last edited by stumpy : June 30th, 2004 at 12:57 AM. Reason: Please use [CODE] or [PHP] tags for code or your post may be deleted.

Reply With Quote
  #2  
Old June 30th, 2004, 01:58 AM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
I quickly glanced at your code but there are a few things you left out.

1 - The one thing you did not mention is where you are having a problem.

2 - You posted about 75-80 lines of code... this should be an attachment.

You would do yourself a lot of good by doing the following:

a. If you are having trouble getting the database to spit out the results you need, check your queries and spit them out to standard output.

b. If you are having trouble with the actual javascript in the drop-downs, you would be better off writing the javascript code in a standalone static html file manually, then test the procedure

c. Try to put these routines together, one line at a time. Take your time.

If you still need help at this point, let me know. If you have the need for the actual javascript that can do the double drop down, let me know. I have written this functionality many times.

There are very little good tutorials on the net concerning this. The ones that are available are usually pretty bad.
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > double drop down and database


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway