Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2004
    Posts
    378

    * Using Select OnChange and Update Database

    I am having a little bit of a problem updating the database with the new value from the drop down box. For some reason it isn't receiving the value of gametheme and updating it.



    $user = mysql_fetch_array(mysql_query("SELECT online,status,username,theme FROM $tab[user] WHERE id='$id';"));

    //runs when form is submitted
    if($gametheme!=$user[3])
    {
    //suppose to update database with new value of gametheme
    mysql_query("UPDATE $tab[user] SET theme='$gametheme' WHERE id='$id'");

    $user = mysql_fetch_array(mysql_query("SELECT online,status,username,theme FROM $tab[user] WHERE id='$id';"));
    }





    <form method="post" action="" name="usertheme">
    <select name="gametheme" onChange="document.usertheme.submit()">
    <option value="0" <? if($user[3]==0){echo "selected";} ?>>blue</option>
    <option value="1" <? if($user[3]==1){echo "selected";} ?>>purple</option>
    <option value="2" <? if($user[3]==2){echo "selected";} ?>>red</option>
    <option value="3" <? if($user[3]==3){echo "selected";} ?>>green</option>
    <option value="4" <? if($user[3]==4){echo "selected";} ?>>dark blue</option>
    <option value="5" <? if($user[3]==5){echo "selected";} ?>>orange</option>
    </select>
    </form>
    Last edited by jdk; 06-27-2005 at 08:45 PM.

  2. #2
    Join Date
    Jul 2004
    Posts
    378
    please close 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
  •