Jump to content

[SOLVED] drop down not being populated


kev wood

Recommended Posts

i have the following code which populates a drop down menu with query results from a mysql db.  i got the page working fine.  i have now change the way the page so that it loads the content into a div tag but since i have done this the code is no longer populating the drop down menu.

 

here is all the code for the contnet which is loaded in the div tag

 

case 10:
		echo'';
		$db = "pipdb"; 
		$con = mysql_connect("localhost","pip","piptables")or die(mysql_error());

		mysql_select_db($db)or die(mysql_error());
		$query="SELECT id, title FROM training";
		$result = mysql_query($query) or die(mysql_error());

		$options = "";

		while ($row=mysql_fetch_array($result)) {

			$id = $row['id'];
			$title = $row['title'];
			$options.="<OPTION VALUE=\"$id\">".$title;
		}

		echo'<form action=\"insert_interest.php\" method=\"POST\">

	<h4>Select which course you would like to register your interest in</h4>

	<h5>Option 1</h5>
	   <select name=\"radio\">
			<OPTION VALUE=0>Please select an option
			 <?=$options?>
	   </select>
	<h5>Option 2</h5>
	(only select more options if needed)<br />
	<br />
		<select name="radio1">
			<OPTION VALUE=0>Please select an option
			<?=$options?>
	    </select>
	<h5>Option 3</h5>
		<select name="radio2">
			<OPTION VALUE=0>Please select an option
			<?=$options?>
	    </select>
	    <br /><br /><h4>Enter the required information</h4>
	    <b>Name:</b><br />
	    <input type="text" name="name" /><br />
	    <b>Address:</b><br />
	    <textarea cols="50" rows="7" name="address" onkeyup="textLimit(this, 150);"></textarea><br />
		<b>Housing Association:</b><br />
	    <input type="text" name="housing" /><br />
	   <b>Email:</b><br />
	   <input type="text" name="email" /><br />
	   <br />
	   <input type="submit" value="Register Interest" />
	      </p>
	</form>';
			break;

 

 

this is the section of code that is not working anymore

 

		<h5>Option 1</h5>
	   <select name=\"radio\">
			<OPTION VALUE=0>Please select an option
			 <?=$options?>
	   </select>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.