monkeyj Posted February 3, 2011 Share Posted February 3, 2011 When I echo the POST, it echoes the correct value. The MySQL portion seems to just ignore it all together. I've tried changing the dropdown option to just a text field, same thing occurred. I have text fields right above this particular one that update just fine with the SAME exactly scripting. if POST, update query, done. Works. This one for some reason will not. MySQL portion: if ($_POST['bUpdate']){ mysql_query("UPDATE `Patients` SET `b` = '$_POST[bUpdate]' WHERE `id` = '".$_GET['id']."'"); } echo $_POST['bUpdate']; Form Portion: <tr onmouseover="color(this, '#baecff');" onmouseout="uncolor(this);"> <td width="310" colspan="2" align="center"><span class="fontoptions">Postcard Status </span><br /> <? if ($data['b'] == 1){ echo '<select name="bUpdate"><option value="1" selected>Yes</option><option value="0">No</option></select>'; } else { echo '<select name="bUpdate"><option value="1">Yes</option><option value="0" selected>No</option></select>'; } ?> </td> </tr> Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted February 3, 2011 Share Posted February 3, 2011 how about the value for $_GET['id']? Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted February 3, 2011 Share Posted February 3, 2011 basic debugging: look at the query. $sql = "UPDATE `Patients` SET `b` = '$_POST[bUpdate]' WHERE `id` = '".$_GET['id']."'"; echo "sql: $sql <br />"; and check to make sure it doesn't fail. mysql_query($sql) or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
monkeyj Posted February 3, 2011 Author Share Posted February 3, 2011 Figured it out. It theoretically was supposed to work everytime. The problem I had was putting it under a if($_POST) because the item will ALWAYS be posted for a radio button. Regardless, I removed the if($_POST) command and just told it to Update it regardless of any 'change'... and it detects it just fine. Thanks BlueSky, cause during the debug, I put a line of code OUTSIDE the if command and it changed. 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.