943,627 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 403
  • PHP RSS
Apr 1st, 2009
0

drop down menu not being populated

Expand Post »
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

PHP Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 27
Solved Threads: 1
Posting Whiz
kevin wood is offline Offline
347 posts
since Feb 2008
Apr 1st, 2009
0

Re: drop down menu not being populated

Pretty straight forward. You are having <?=$options?> in echo.
End the echo statement then echo $options.
Example,
php Syntax (Toggle Plain Text)
  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...
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Apr 1st, 2009
0

Re: drop down menu not being populated

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
Reputation Points: 27
Solved Threads: 1
Posting Whiz
kevin wood is offline Offline
347 posts
since Feb 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC