bCourtney07 Posted November 26, 2008 Share Posted November 26, 2008 Hello All, I have an access database for class registration, and I can't figure out how to create drop down lists from dates of the class. I was just wondering if someone could assist with this, or know of a good tutorial or something. What I need to have done is, have one drop down box for the class name, and when a class name is selected, a second drop down box auto populates with the dates associated with the class name in the database. Here is the main form code <?php //config file contains connection to the database. require("config.php"); $today = date("m/d/Y"); $Class_Date = "SELECT Class_Date, Class_Name FROM Class_Information WHERE Class_Date >= '$today' AND Class_Name = 'ARP' "; $rs = $conn->Execute($Class_Date); ?> <form action="Register.php" method="post"> <table border="1" align="center"><tr><td>Employee Name: </td><td><input type=text name=Employee_Name></td></tr> </tr><tr><td>Extension: </td><td><input type=text name=Extension></td></tr><tr><td>Class Name:</td><td><select name=Class_Name><option value=" ">Please select class</option><option value=ARP>ARP</option><option value="Skills Day">Skills Day</option></select></td></tr> <?php while (!$rs->EOF) { ?> <tr><td>Class Dates:</td><td><select name="Class_Date"><option><?php echo $rs->Fields['Class_Date']->Value ?></option></select></td> <?php $rs->MoveNext(); ?> <?php } ?> </tr><tr><td colspan="2"><input type="submit" value="Register"></td></tr></table></form> <?php //closes all connections $rs->Close(); $conn->Close(); $rs = null; $conn = null; ?> config.php <?php $conn = new COM ("ADODB.Connection") or die("Cannot start ADO"); $connStr = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=F:\Class Registration/Class_Registration.mdb;"; $conn->open($connStr); //Open the connection to the database ?> and the register.php file is just the file that enters the info into the database. Any help or direction in this would be greatly appreciated! I have attached what the form looks like with the code above also. THanks so much! [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/134378-php-drop-down-list-with-ms-access-db/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.