drop down menu not being populated

Thread Solved

Join Date: Feb 2008
Posts: 347
Reputation: kevin wood is an unknown quantity at this point 
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

drop down menu not being populated

 
0
  #1
Apr 1st, 2009
this code was working fine until i changed the way the site loads the content (it now loads the content into a div tag) and since then it will not populate the menu.

the page can be viewed at

this site

you will need to go to the sub links on the left and click the Register Interest in Courses link.

here is the code that is not working

  1. case 10:
  2. echo'';
  3. $db = "pipdb";
  4. $con = mysql_connect("localhost","pip","piptables")or die(mysql_error());
  5.  
  6. mysql_select_db($db)or die(mysql_error());
  7. $query="SELECT id, title FROM training";
  8. $result = mysql_query($query) or die(mysql_error());
  9.  
  10. $options = "";
  11.  
  12. while ($row=mysql_fetch_array($result)) {
  13.  
  14. $id = $row['id'];
  15. $title = $row['title'];
  16. $options.="<OPTION VALUE=\"$id\">".$title;
  17. }
  18.  
  19. echo'<form action=\"insert_interest.php\" method=\"POST\">
  20.  
  21. <h4>Select which course you would like to register your interest in</h4>
  22.  
  23. <h5>Option 1</h5>
  24. <select name=\"radio\">
  25. <OPTION VALUE=0>Please select an option
  26. <?=$options?>
  27. </select>
  28. <h5>Option 2</h5>
  29. (only select more options if needed)<br />
  30. <br />
  31. <select name="radio1">
  32. <OPTION VALUE=0>Please select an option
  33. <?=$options?>
  34. </select>
  35. <h5>Option 3</h5>
  36. <select name="radio2">
  37. <OPTION VALUE=0>Please select an option
  38. <?=$options?>
  39. </select>
  40. <br /><br /><h4>Enter the required information</h4>
  41. <b>Name:</b><br />
  42. <input type="text" name="name" /><br />
  43. <b>Address:</b><br />
  44. <textarea cols="50" rows="7" name="address" onkeyup="textLimit(this, 150);"></textarea><br />
  45. <b>Housing Association:</b><br />
  46. <input type="text" name="housing" /><br />
  47. <b>Email:</b><br />
  48. <input type="text" name="email" /><br />
  49. <br />
  50. <input type="submit" value="Register Interest" />
  51. </p>
  52. </form>';
  53. break;

any help would be great with this.

i know it has something to do with how i am echoing the information out.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,761
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: drop down menu not being populated

 
0
  #2
Apr 1st, 2009
Pretty straight forward. You are having <?=$options?> in echo.
End the echo statement then echo $options.
Example,
  1. echo'<form action=\"insert_interest.php\" method=\"POST\">
  2.  
  3. <h4>Select which course you would like to register your interest in</h4>
  4.  
  5. <h5>Option 1</h5>
  6. <select name=\"radio\">
  7. <OPTION VALUE=0>Please select an option';
  8. echo $options;
  9. echo '</select>
  10. <h5>Option 2</h5>
  11. (only select more options if needed)<br />
  12. <br />
  13. <select name="radio1">
  14. <OPTION VALUE=0>Please select an option';
  15. echo $options;
  16. //and so on...
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 347
Reputation: kevin wood is an unknown quantity at this point 
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

Re: drop down menu not being populated

 
0
  #3
Apr 1st, 2009
thanks once again for your help.

i had tried nearly every variation of putting the echo in different places and closing it out on different lines. just didnt think about the fact that the page was php and didnt need the html tags to display the php variables.

thank you again
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 325 | Replies: 2
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC