how to insert values from combo box into mysql table

Discussion in 'Programming/Scripts' started by abc, Nov 22, 2010.

  1. abc

    abc New Member

    I have made a combo box in dreamweaver using php.After selecting any of the field from the combo box the user writes his topic in text box related to that particular field.In mysql i have made separate tables of every field mentioned in combo box.Now i wnat that whenever user press the submit button after selecting the field from combo box the topic he writes in the textbox is inserted to that relevent table for example if networking field is selected then the topic in text box should be saved in the networking table in database.I am posting the code.Any kind of help will be appreciated.
    <form name=myform>
      <table width="75%" border="1">
          <td width="28%" valign="top"><p>Choose any field: </p>
          <td width="72%" valign="top"><p>
              <select name=mytextarea>
                <option name=Website development value=website> website development 
                <option name=networking value=networking > networking </option>
                <option name=databases value=databases> databases </option>
          <td>Enter your topic related to field: 
          <td><input name="topic" type="text" id="topic4"></td>
          <td><input name="submit" type="submit" id="submit3" value="Submit"></td>
  2. falko

    falko Super Moderator ISPConfig Developer

    Try something like

    $mytextarea as $option){
    $sql "INSERT INTO ".$option." ..."// This assumes that your database tables are named exactly like the values from the <option> value fields. Make sure you complete the SQL statement.
        // Now fill in your PHP code to execute the MySQL query.
  3. abc

    abc New Member

    Thanks a lot
  4. abc

    abc New Member

    thanks a lot

Share This Page