מה משובש? הנה הקוד..
זה ה -HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>הוספת קטיגוריה חדשה</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1255"> <META http-equiv="content-language" content="hw"> </head> <body> <form name="form1" method="POST" lang="he" action="<?php echo $editFormAction; ?>"> <input type="text" name="catergory_name" id="catergory_name" lang="he"> <br> <input type="submit" name="Submit" value="Submit"> <input type="hidden" name="MM_insert" value="form1"> </form>
וזה ה - PHP קצת ארוך אבל נוח לי ככה עם הפונקציה הזו
<?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 = $HTTP_SERVER_VARS['PHP_SELF']; if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING']; } if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO categories (catergory_name) VALUES (%s)", GetSQLValueString($HTTP_POST_VARS['catergory_name'], "text")); mysql_select_db($database_mysql_link, $mysql_link); $Result1 = mysql_query($insertSQL, $mysql_link) or die(mysql_error()); $insertGoTo = "new_category.php"; if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); }