Selecting option from a textarea

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chocomon
    New Member
    • Feb 2012
    • 10

    Selecting option from a textarea

    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..
    Code:
    <?php
    //create a database connection
    mysql_connect("10.11.143.151", "group1","group1") or die(mysql_error());
    //select your database
    mysql_select_db("group1");
    ?>
    
    <html>
    <body>
    <form action="combobox.php" method="post">
    <select name="combobox" id="combobox" size="20">
    <?php
    
    $query = mysql_query("select * from help_file"); 
    //return the array
    while ($row = mysql_fetch_array($query)){
    
        $title = $row['title'];
        $content = $row['content'];
    ?>
    <option name="title"><?php echo $title;?></option>
    
    <?php }
    ?>
    </select>
    <?php
    include 'combobox.php';
    ?>
    </form>
    </body>
    </html>
    So what code would i have to have so that if the user clicks on an option, its article automatically opens up?
    Thanks~
Working...