xoligy Posted August 3, 2009 Share Posted August 3, 2009 Ok ive been trying to add multiple submit buttons to a page that basically update something in the db (simple eh!) problem im having is i carn't find the right info i require well i dont think i can anyway i look at the code ty and no luck Here is the code i was using that works on one submit button its not the best coding i know and thats why i need a push in the right direction: <? if($_POST[medals]){ mysql_query("UPDATE $tab[pimp] SET medals='off' WHERE id=$pimp[id]"); } // can use }else{ here i know if($_POST[medals]){ mysql_query("UPDATE $tab[pimp] SET medals='on' WHERE id=$pimp[id]"); } $tog = mysql_fetch_array(mysql_query("SELECT medals FROM $tab[pimp] WHERE id=$pimp[id]")); if($tog[0] == "on"){$toggle="on";} // can be removed i know else{$toggle="off";} // can be removed i know ?> <td><form method="post" action=""><input type="submit" name="<?=$toggle?>" value="<?=$toggle?>"></td> Now if i added a new button and with a new function it looks like it works but then it fails because you click "on" on one and it switches the other off lol Can someone point me in the right direction of a good tutorial or have patience and help me out? Quote Link to comment Share on other sites More sharing options...
xoligy Posted August 5, 2009 Author Share Posted August 5, 2009 Guess i'll spend another few hrs at this and then just set up seperate pages which isnt what i really want :/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.