By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,804 Members | 1,364 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,804 IT Pros & Developers. It's quick & easy.

Selecting option from a textarea

P: 10
Hello, i've coded a textarea where a person can select an option (title of an article) and then that article will display in an adjacent table..
Now this i primarily coded in php and html but from what i've looked through in google, it seems that i also need to use a javascript event handler in order for the textarea to send the selected option to my php sql_query search in another file (the query will then look for the associated article in my sql database) and display it in the aforementioned table..

so here's my code..
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. //create a database connection
  3. mysql_connect("", "group1","group1") or die(mysql_error());
  4. //select your database
  5. mysql_select_db("group1");
  6. ?>
  8. <html>
  9. <body>
  10. <form action="combobox.php" method="post">
  11. <select name="combobox" id="combobox" size="20">
  12. <?php
  14. $query = mysql_query("select * from help_file"); 
  15. //return the array
  16. while ($row = mysql_fetch_array($query)){
  18.     $title = $row['title'];
  19.     $content = $row['content'];
  20. ?>
  21. <option name="title"><?php echo $title;?></option>
  23. <?php }
  24. ?>
  25. </select>
  26. <?php
  27. include 'combobox.php';
  28. ?>
  29. </form>
  30. </body>
  31. </html>
So what code would i have to have so that if the user clicks on an option, its article automatically opens up?
May 30 '12 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.