Rabastan Posted May 27, 2012 Share Posted May 27, 2012 I have this code produced by dreamweaver. That allows me to click a checkbox and change a Enum Value from no to yes. <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE todo SET completed=%s WHERE id=%s", GetSQLValueString(isset($_POST['updatetodo']) ? "true" : "", "defined","'Y'","'N'"), GetSQLValueString($_POST['hiddenField'], "int")); mysql_select_db($database_sitterlink, $sitterlink); $Result1 = mysql_query($updateSQL, $sitterlink) or die(mysql_error()); $updateGoTo = "../../index.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } mysql_select_db($database_sitterlink, $sitterlink); $query_todopending = "SELECT * FROM todo"; $todopending = mysql_query($query_todopending, $sitterlink) or die(mysql_error()); $row_todopending = mysql_fetch_assoc($todopending); $totalRows_todopending = mysql_num_rows($todopending); ?> How would I eliminate the checkbox so I could just hit submit and have it update. Rab Quote Link to comment https://forums.phpfreaks.com/topic/263225-update-record/ 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.