need help in dynamic select menu in php


Posted on 16th Feb 2014 07:03 pm by admin

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

Code: <!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
Code: <?php
$day = $_POST["day"];

echo $day;
?>

No comments posted yet

Your Answer:

Login to answer
305 Like 47 Dislike
Previous forums Next forums
Other forums

setcookie and isset($_COOKIE(name)) seem very finnicky.
I'm currently playing around with a user system with login and registration. I'm trying to use cooki

LOOPing Problem
Hello All!

The following code loops through the data and displays the data accordingly. My p

no idea what to do...
I'm fed up. I had issues with code that I have working on a different site that didn't work on my cu

file_put_contents and createimagefromjpeg
All,
I do somethings and then I have the following code:
file_put_contents('./test/'.$filename

"From field" in PHP email form
I used a wizard to create a PHP email form. I was able to customize it with the exception of the Fr

Add User script "Could not execute query"
This should be an easy script but I can't get it to run. Can someone please help me?

<

Linking with Foreign Keys
I have been getting an erro when I try and link:

create table Faculty_Specialty (I_Name v

php calculate
this code echoes correctly the sum but the inserted result is 0??
Code: <?php
$TotalNum

Count Session and Trigger Events
I am New in PHP, seeking a method to count logged users by counting the sessions or any …, is

Code Review - SQL and Insertion Attacks (Warning: Not for Newbs)
Hey guys,

Its been a while, I know. Use to love coming here to answer peoples questions, but

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash