Dynamic Pulldown Menu question
Posted: Wed Oct 13, 2004 9:15 pm
nigma | Help us, help you. Please use
Thanks for any help,pointers,tips and/or constructive criticism!
Handler
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Greetings!
I have this little piece of code I've been playing with. I'm learning php/mysql bit by bit. And to me it seems really drawn out on reading the reocords from the database untill the end. Is there a more 'compact' method of doing this?
Here's what I have so far (it works).Code: Select all
<html>
<head>
</head>
<body>
<form method=post action="index.php">
<select name="rating">
<?php
include_once ("./settings.php");
$link = mysql_connect($host,$user,$password);
$result=mysql_db_query($dbname,"select * from months",$link);
while($row = mysql_fetch_array($result)) {
if ($result > 0) {
$num4=mysql_num_rows($result);
if($num4!=0) {
$n=0;
while ( $n<$num4 ) {
$sign=mysql_result($result,$n,"sign");
$n++;
if (!$size) $size="0 kb";
echo "<option selected value='$sign'>$sign</option>\n";
}
}
}
}
?>
</select>
<input type="submit" value="next">
</form>
</body>
</html>Handler