I have some grid which use form edit. But after edit success then page reload the data in grid back to the beginning. Its mean that edit process is failed.
I have confused how to post this all variable into process page, because i’m use switch-case for this php page. I put some hidden action inside the form:
<form id="editdefdata" class="editable">
<input id="action" name="action" value="changedefdata" type="hidden" />
<button id="defupdate"><span>Update </span></button>
</form>
this the data will be post to process page:
Problem_date:2011-06-10
Line:FA 14
Shift:N
Model:KD-R321EUD
Serial_number:116V4262
DIC:IQC
Def_class:B
Symptom:CD eject shifting
Cause:Under investigate
Symgrup:Function
Modgrup:KD
oper:edit
def_id:15
and this is the process or php page:
$dbc=mysql_connect(_SRV,_ACCID,_PWD) or die(_ERROR15.": ".mysql_error());
$db=mysql_select_db("qdbase",$dbc) or die(_ERROR17.": ".mysql_error());
switch(postVar('action')) {
case 'oper':
edit(postVar('def_id'),postVar('DIC'),postVar('Def_class'),postVar('Symptom'),postVar('Cause'));
break;
case 'deldefdata':
//postVar blabla....
break;
}
function edit($def_id,$DIC,$Def_class,$Symptom,$Cause){
$defID = mysql_real_escape_string($def_id);
$DIC = mysql_real_escape_string($DIC);
$Defclass = mysql_real_escape_string($Def_class);
$Symp = mysql_real_escape_string($Symptom);
$Cause = mysql_real_escape_string($Cause);
$DIC=strtoupper($DIC);
$Defclass=strtoupper($Defclass);
$sql = "UPDATE oqc_defect SET DIC = '".$DIC."', Def_class = '".$Defclass."', ";
$sql.= "Symptom = '".$Symp."', Cause = '".$Cause."' ";
$sql.= "WHERE def_id = ".$defID;
echo $sql;
$result=mysql_query($sql) or die(_ERROR26.": ".mysql_error());
//echo $result;
mysql_close($dbc);
}
Could you tell me the correct answer for this case?
I have found the answer by my self.it’s make me so glad, I’m going mad for 1 week because of this problem. All ways I have tried but for this day I have found the real answer.
first
If you want to post some parameters you must be check the parameter’s name that will be post to server.On this case, make sure that your
colModel's namesame with your php file(_POST,postVar, or REQUEST).second
change the
prmNamesmake same with your current parameter operation.In this case, I need to change like:
that’s the root cause of my problem.That’s why the script confuse during identifying some variable. The parameter below is the correct result: