iamnottheend Posted March 14, 2007 Share Posted March 14, 2007 I am pretty sure it works. I just think i have my if statements wrong. I am not very good with forms and this is the first time i have used radio buttons and well something is going wrong. Form <form action="{$currentpage}" method="post"> <input type="radio" name="availible" value="Availible"> Availible <br /> <input type="radio" name="availible" value="NotAvailible"> Not Avilible <input type="submit" name="AvailibleSubmit" value="submit" /> </form> php if ($_POST['AvailibleSubmit']) { if ($_POST['availible'] = "Availible") { $sql="UPDATE `designer_status` SET `amavailible` = '1' WHERE `designer_status`.`amavailible` =1 LIMIT 1"; $result = mysql_query($sql); if ($result) { echo "database changes have been made. Press <a href=\"admin.php\">back</a> to continue."; } else { echo "database changes failed, please try again"; } } if ($_POST['availible'] = "NotAvailible") { $sql="UPDATE `designer_status` SET `amavailible` = '0' WHERE `designer_status`.`amavailible` =1 LIMIT 1"; $result = mysql_query($sql); if ($result) { echo "database changes have been made. Press <a href=\"admin.php\">back</a> to continue."; } else { echo "database changes failed, please try again"; } } } Output database changes have been made. Press back to continue.database changes have been made. Press back to continue. What i believe is happening is that both if statements are running, this means that they are wrong. Could someone correct them for me so i can see where i am going wrong. Thanks Quote Link to comment Share on other sites More sharing options...
aebstract Posted March 14, 2007 Share Posted March 14, 2007 if (isset($_POST['AvailibleSubmit'])) { if (isset($_POST['availible'])) { $sql="UPDATE `designer_status` SET `amavailible` = '1' WHERE `designer_status`.`amavailible` =1 LIMIT 1"; $result = mysql_query($sql); if ($result) { echo "database changes have been made. Press <a href=\"admin.php\">back</a> to continue."; } else { echo "database changes failed, please try again"; } } else { $sql="UPDATE `designer_status` SET `amavailible` = '0' WHERE `designer_status`.`amavailible` =1 LIMIT 1"; $result = mysql_query($sql); if ($result) { echo "database changes have been made. Press <a href=\"admin.php\">back</a> to continue."; } else { echo "database changes failed, please try again"; } } } Changed a few lines just to make it check if the variable isset or not, this is causing it to do one or the other, noth both. Is this what you were looking for? 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.