czs Posted February 22, 2008 Share Posted February 22, 2008 Right now I have these two working update queries that dreamweaver made for me: if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE tblprofile SET Match1=%s WHERE email=%s", GetSQLValueString($_POST['M1Accept'], "text"), GetSQLValueString($_POST['M1email'], "text")); mysql_select_db($database_connPFD, $connPFD); $Result1 = mysql_query($updateSQL, $connPFD) or die(mysql_error()); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE tblprofile SET ConMatch1=%s WHERE email=%s", GetSQLValueString($_POST['M1email'], "text"), GetSQLValueString($_POST['HFEmail'], "text")); mysql_select_db($database_connPFD, $connPFD); $Result1 = mysql_query($updateSQL, $connPFD) or die(mysql_error()); } The first one inputs the value from a radio group named M1accept into the database. M1accept is a radio group that either submits this if true: <?php echo $_SESSION['MM_Username']; ?> and just a 0 if false. Here is the thing. I only want the second update listed above to run only if the user clicked the true value for M1accept radio group. So if <?php echo $_SESSION['MM_Username']; ?> gets sent in then I want the second query to run but if "0" gets submitted then I don't want the second query listed above to run. Is there to put some sort of if statement around the second update that I have? Any other way to do this? Thank you very much Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted February 22, 2008 Share Posted February 22, 2008 maybe put this if around the other one: if ($_POST['M1Accept'] == 1) { // Go ahead and do something. } Quote Link to comment Share on other sites More sharing options...
czs Posted February 22, 2008 Author Share Posted February 22, 2008 Thank you so much! Your exact code didn't work but it inspired me to create the code that did work. This is awesome. Instead of if ($_POST['M1Accept'] == 1 I just put if ($_POST['M1Accept'] == $_SESSION['MM_Username'] Which is the value that M1accept submits if true. Thanks! 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.