مشکل رو تقریبا پیدا کردم ولی بازم نمی دونم چه جوری حلش کنم
فهمیدنم که اصلا idcat از فرم قبلی (همون فرمی که اطلاعات رو می فرسته ) وارد این فرم ( فرم جاری ویرایش اطلاعات ) نمیشه
اینم فرم ایجاد دسته یه نگاهی به اینا بندازین ببینین چیزی دستگیرتون میشه
<?php require_once('../Connections/pop.php'); ?>
<?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_insert"])) && ($_POST["MM_insert"] == "createcat")) {
$insertSQL = sprintf("INSERT INTO cat (catname) VALUES (%s)",
GetSQLValueString($_POST['catname'], "text"));
mysql_select_db($database_pop, $pop);
$Result1 = mysql_query($insertSQL, $pop) or die(mysql_error());
$insertGoTo = "cat.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_pop, $pop);
$query_catrecord = "SELECT * FROM cat";
$catrecord = mysql_query($query_catrecord, $pop) or die(mysql_error());
$row_catrecord = mysql_fetch_assoc($catrecord);
$totalRows_catrecord = mysql_num_rows($catrecord);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>دسته بندی</title>
</head>
<body><div id="cat" align="right">
<form action="<?php echo $editFormAction; ?>" method="POST" name="createcat">
<table width="412" border="0">
<tr>
<td width="326"><input type="text" name="catname" width="100%" />
</td>
<td width="76"><input type="submit" value="ایجاد دسته جدید" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="createcat" />
<input type="hidden" name="idcat1" value="<?php echo $row_catrecord['idcat']; ?>" />
</form><br />
<div style="height:500px; overflow:auto;">
<table width="400" border="1" style="text-align:center">
<tr>
<td width="25">id</td>
<td width="212">اسم دسته</td>
<td width="69">حدف</td>
<td width="66">ویرایش</td>
</tr>
<?php do { ?>
<tr>
<td height="41"><?php echo $row_catrecord['idcat']; ?></td>
<td style="text-align:right"><?php echo $row_catrecord['catname']; ?></td>
<td><a class="active" target="_blank" onClick="window.open('catdel.php?id=<?php echo$row_catrecord['idcat'] ;?>','popupwindow','stat us=yes,scrollbal=yes,width=300,height=300'); return false;"><img src="../img/catdele.png" width="23" height="24" alt="حذف" /></a></td>
<td><a href="catedit.php?idcat<?php echo $row_catrecord['idcat']; ?> "><img src="../img/catedit.png" alt="remove" width="34" height="31" /></a></td>
</tr>
<?php } while ($row_catrecord = mysql_fetch_assoc($catrecord)); ?>
</table>
<br />
تعداد دسته های ثبت شده :
<?php echo $totalRows_catrecord ;?>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($catrecord);
?>