Forum Moderators: coopster

Message Too Old, No Replies

form question

         

RogueDogg

4:35 am on Jun 9, 2006 (gmt 0)

10+ Year Member



Can anyone tell me what is wrong with this and why it won't show anything in the drop down menu? I don't get any errors either.

<FORM name="faqform" method="post" action="<? echo $_SERVER['PHP_SELF'];?>">
Choose a question:<br />
<select name="question">

<?
$db = mysql_connect ("localhost","dbuser","dbpass");
$link = mysql_select_db ("dbname", $db);
$query = "select * from question";
$result = mysql_query($query);
while ($record = mysql_fetch_assoc($result)){
echo "<option value = '".$record["qid"]."'>".$record["qustion"];
}
?>
</select>
</FORM>

And yes there is data in the question table. There is a column called qid and question for a total of 2 columns and only 1 row as of right now.

omoutop

6:04 am on Jun 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



perhaps there is an errro here $record["qustion"];

should it be $record["question"];?

check your spelling... the code seems correct, not sure on table/colum names though

dreamcatcher

7:14 am on Jun 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



RogueDogg, always set your error reporting level to E_ALL for development. It will pick up on these kind of things.

error_reporting(E_ALL);

I think omoutop is right about the spelling issue.

dc

RogueDogg

5:11 pm on Jun 9, 2006 (gmt 0)

10+ Year Member



Yep that did it. THANKS...damn some of the smallest details will drive you insane. As for the error reporting, GREAT idea, I will try to remember that for the future.

I have a question however, I found this tutorial online and kinda fixed it up to work with what I was needing, however...I have been unable to find a tutorial on how to display the result of that question ( in the drop down menu ) into a "no editable" text box. Has anyone had any expirience with this or know of a place I might find this info I'm looking for?

Thanks again... (thumbsup)