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

Did you know?Explore Trending and Topic pages for more stories like this.
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

Print out contents of to Excel
I have got this script that gathers all the data that I need but I need it to send it to excel inste

displaying email without attracting a ton of spam
Hello,

this is maybe the wrong place to ask.
How would you display an email address on a w

How to show more than 1 users with this code...
Hello,
i have a table that shows users only if I, as Administrator, want to be shown. But its sho

php sessions,logouts & the bloomin back button!
Hi All,

I've got a cms that members can log into. When they logout, the session is destroyed,

Delete all from a table
I can not get the following code to work. If I run the sql statement in the db it will delete all t

Join Query Help
Hi all,

I am having problems with the below code, which we shall call 'my first join query'!

Grids not displaying decimals, and behaving differently on different PCs?
Hello,

I coded a relatively simple MII application that allows data from a form to be add

Redirecting Admin
In my members table, I have a field called "perm" and it's set to zero for all members. Ho

pagination numbering pattern
Hello,

I have following code which works great for pagination. but i have small issue now.

If statement help please.
Hello on my site I have 2 content boxes. 1 is for the main content (which is the biggest one) and th

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