Results 1 to 2 of 2

Thread: Php help! Also needs ajax probably!

  1. #1
    Join Date
    Jan 2011

    Question Php help! Also needs ajax probably!

    Ok, so heres my question. I have a select dropdown that is populated from my table, category_names. I am getting the id and the name and using the id as the value. And the name as the select name.

          $query="SELECT id,name FROM category_names";
          $result = mysql_query ($query);
          echo "<strong>Pick as many that fit your business</strong><br/><br/>";
          echo"<div style='overflow:auto;height:300px;width:100%'><select>";
          // while loop
          while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
          echo "<option value=NAME=$nt[id]>$nt[name]</option><br/>
    Ok so that populates my select. But now I want to hit a little "ADD" hyperlink at the bottom and another identical select dropdown to appear underneath that is also populated from my database. And each select needs to add to a different row in table. How do I achieve this?

  2. #2
    Join Date
    May 2010
    Manila, Philippines
    If you mean when clicking the select is you want the selected item to be saved at the database you can achieve this by using a form (definitely). The select has a property of onclick, on that property call a javascript function that activates the form. Then the form calls for a procedure or mostly called action that will get the selected item and then save it on the database. =) pretty easy isn't it..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center