Thundarfoot Posted January 16, 2008 Share Posted January 16, 2008 I am using dreamweaver 8.0 as editor to create a dynamic list/menu form thingy. the click box pulls its values from a mysql table letting the user choose from 30 options. however, there is no way to apply the choice..no Go button or anything. just the label (class) and the drop down options.. I would like an apply button that when clicked would execute a mysql query. Below is the code I use, its a bit sloppy due to the dreamweaver editor.... Thanks in advance for your time. -------------------------------------- $query_Recordset1 = "SELECT `Class` FROM class_list ORDER BY id ASC"; $Recordset1 = mysql_query($query_Recordset1, $Lw) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); <head> </head> <body> <form id="form1" name="form1" method="post" action=""> <label>Class <select name="select"> <?php do { ?> <option value="<?php echo $row_Recordset1['Class']?>"><?php echo $row_Recordset1['Class']?></option> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); $rows = mysql_num_rows($Recordset1); if($rows > 0) { mysql_data_seek($Recordset1, 0); $row_Recordset1 = mysql_fetch_assoc($Recordset1); } ?> </select> </label> <label></label> </form> </html> <?php mysql_free_result($Recordset1); ?> Link to comment https://forums.phpfreaks.com/topic/86235-solved-learning-forms-using-dreamweaver-wheres-the-button/ Share on other sites More sharing options...
darkfreaks Posted January 16, 2008 Share Posted January 16, 2008 <?php $query_Recordset1 = "SELECT `Class` FROM class_list ORDER BY id ASC"; $Recordset1 = mysql_query($query_Recordset1, $Lw) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> <head> </head> <body> <form id="form1" name="form1" method="post" action=""> <label>Class <select name="select"> <?php do { ?> <option value="<?php echo $row_Recordset1['Class']?>"><?php echo $row_Recordset1['Class']?></option> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); $rows = mysql_num_rows($Recordset1); if($rows > 0) { mysql_data_seek($Recordset1, 0); $row_Recordset1 = mysql_fetch_assoc($Recordset1); } ?> </select> </label> <label></label> <input type="submit" name="submit" value="submit"> </form> </html> <?php mysql_free_result($Recordset1); ?> Link to comment https://forums.phpfreaks.com/topic/86235-solved-learning-forms-using-dreamweaver-wheres-the-button/#findComment-440471 Share on other sites More sharing options...
Thundarfoot Posted January 16, 2008 Author Share Posted January 16, 2008 Thank you very much! That was exactly what I was struggling with. Now of course I have to figure out how to make that submit button take the value of the drop box (i.e choice 1) and place it into a variable that I can call from the mysql query. Link to comment https://forums.phpfreaks.com/topic/86235-solved-learning-forms-using-dreamweaver-wheres-the-button/#findComment-440479 Share on other sites More sharing options...
Thundarfoot Posted January 16, 2008 Author Share Posted January 16, 2008 Thanks, got it figured out! Link to comment https://forums.phpfreaks.com/topic/86235-solved-learning-forms-using-dreamweaver-wheres-the-button/#findComment-440641 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.