Jump to content

Archived

This topic is now archived and is closed to further replies.

redarrow

select box problam please help

Recommended Posts


my select box wont show please help cheers

[code]

<html>
<head>
<title>search2</title>
<body>
search me via search box
<form  method="post" action="search.php>
<SELECT NAME="name">
<?
$db=mysql_connect("localhost","xxx","xxx");
mysql_select_db("freedating", $db);
$query="select * from pro_membersu";
$result=mysql_query($query);
while($record=mysql_fetch_assoc($result)){
echo"<OPTION VALUE='".$record["fname"]."'>".$record[name];
}

?>
<input type="submit" value="submit">
</select>
</form>
</body>
[/code]

Share this post


Link to post
Share on other sites
Move the select closing tag ahead of the submit input and close the option tags.
[code]<html>
<head>
<title>search2</title>
<body>
search me via search box
<form  method="post" action="search.php>
<SELECT NAME="name">
<?
$db=mysql_connect("localhost","xxx","xxx");
mysql_select_db("freedating", $db);
$query="select * from pro_membersu";
$result=mysql_query($query);
while($record=mysql_fetch_assoc($result)){
echo "<OPTION VALUE='".$record["fname"]."'>".$record[name]. "</option>";
}
echo "</select>";
?>
<input type="submit" value="submit">

</form>
</body>[/code]

Share this post


Link to post
Share on other sites
still nothink andy cheers ok,


The $record[name]; is suppose to echo the box out but dosent but if i use the fname at the end i get the results with no box wired.

thank you.

Share this post


Link to post
Share on other sites
Assuming both these variables exist in the database and that the db contains data, what does the [b]generated html [/b]look like if you use this:
[code]echo "<OPTION VALUE='". $record['fname']. "'>". $record['name']. "</option>";[/code]

Share this post


Link to post
Share on other sites


sorry typo on the form i have left the " out cheers
[!--sizeo:5--][span style=\"font-size:18pt;line-height:100%\"][!--/sizeo--]
soved[!--sizec--][/span][!--/sizec--]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.