doforumda Posted October 15, 2009 Share Posted October 15, 2009 hi i have created a dynamic select menu using php. i have a problem in that which is when the user select any value in that menu and press submit then it does not pass to next page. my code is here <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> </head> <body> <?php $db = mysql_connect("localhost"); mysql_select_db("test", $db); $query = "SELECT * FROM day" or die(mysql_error()); // id='".$id."' //echo $query; $result = mysql_query($query) or die(mysql_error()); ?> <form name="form1" method="post" action="date.php"> <label>Date: <select name="day" id="day"> <?php while( $row = mysql_fetch_array($result) ) { ?> <option value="<?php $row['id']; ?>"><?php echo $row['day']; ?></option> <?php } ?> </select> </label> <p> <label> <input type="submit" name="button" id="button" value="Submit"> </label> </p> </form> </body> </html> the next page is <?php $day = $_POST["day"]; echo $day; ?> Link to comment https://forums.phpfreaks.com/topic/177750-need-help-in-dynamic-select-menu-in-php/ Share on other sites More sharing options...
sasa Posted October 15, 2009 Share Posted October 15, 2009 change line <option value="<?php $row['id']; ?>"><?php echo $row['day']; ?></option> to <option value="<?php echo $row['id']; ?>"><?php echo $row['day']; ?></option> Link to comment https://forums.phpfreaks.com/topic/177750-need-help-in-dynamic-select-menu-in-php/#findComment-937224 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.