دوستان من هنوز مشکل دارم، با راهنمایی وحید عزیز هم نتونستم به اطلاعات فیلدهام دسترسی پیدا کنم. اینجا کد قسمتی که بعد از Submit اجرا میشن رو میذارم لطفا راهنماییم کنید مشکل چیه. اطلاعات فیلدهای من اصلا از فرم بازگردانی نمیشن.
<?php
ob_start();
//get action
$a = @$HTTP_POST_VARS["a"];
switch ($a)
{
case "A":
// Add
//get fields from form
$tedad = @$HTTP_POST_VARS["tedad"];
$tedad = $tedad + 1;
$forr = 1;
$x_Dars = @$HTTP_POST_VARS["dars"];
do
{
$term11[$forr] = @$HTTP_POST_VARS["x_term11[$forr]"];
$term12[$forr] = @$HTTP_POST_VARS["x_term12[$forr]"];
$term21[$forr] = @$HTTP_POST_VARS["x_term21[$forr]"];
$term22[$forr] = @$HTTP_POST_VARS["x_term22[$forr]"];
$x_StudentId[$forr] = @$HTTP_POST_VARS["x_stuid[$forr]"];
$userquery=mysql_query("select StudentId, Username from student where Username = '$x_StudentId[$forr]'");
$userresult = mysql_num_rows($userquery);
if($userresult==0)
{
echo "<script>alert('خطایی در یافتن دانش آموز برای ثبت نمره روی دارد.'); history.back();</script>";
exit();
}
$userrow = mysql_fetch_array($userquery);
$studid = $userrow['StudentId'];
$fieldList[] = "`CourseSectionId`";
$theValue = (!get_magic_quotes_gpc()) ? addslashes($x_Dars) : $x_Dars;
$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
$valList[] = $theValue;
$fieldList[] = "`term11`";
$theValue = (!get_magic_quotes_gpc()) ? addslashes($x_term11) : $term11[$forr];
$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
$valList[] = $theValue;
$fieldList[] = "`term12`";
$theValue = (!get_magic_quotes_gpc()) ? addslashes($x_term12) : $term12[$forr];
$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
$valList[] = $theValue;
$fieldList[] = "`term21`";
$theValue = (!get_magic_quotes_gpc()) ? addslashes($x_term21) : $term21[$forr];
$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
$valList[] = $theValue;
$fieldList[] = "`term22`";
$theValue = (!get_magic_quotes_gpc()) ? addslashes($x_term22) : $term22[$forr];
$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
$valList[] = $theValue;
$fieldList[] = "`StudentId`";
$theValue = (!get_magic_quotes_gpc()) ? addslashes($studid) : $studid;
$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
$valList[] = $theValue;
$insertSQL = "INSERT INTO `nomarat` (";
for ($i = 0;$i < count($fieldList); $i++) {
$insertSQL .= $fieldList[$i];
if ($i != count($fieldList) - 1) {
$insertSQL .= ",";
};
};
$insertSQL .= ") VALUES (";
for ($i = 0;$i < count($valList); $i++) {
$insertSQL .= $valList[$i];
if ($i != count($valList) - 1) {
$insertSQL .= ",";
};
};
$insertSQL .= ")";
$rs = mysql_query($insertSQL, $ServerConnect) or die(mysql_error());
mysql_free_result($rs);
mysql_close($ServerConnect);
$forr = $forr + 1;
} while ($forr < $tedad);
//end do
ob_end_clean();
header("Location: admin_nomarat_add.php");
break;
}