jquery - posting a single dimenstion array to db ajax post -
I have this form, which loads details using the jazz loader load function
& lt; Form id = "form1" name = "form1" method = "post" verb = "" & gt; & Lt; Div id = "tablebg" & gt; & Lt; Width of the table = "100%" range = "0" cellspacing = "0" cellpadding = "0" class = "list" & gt; & Lt; Thead & gt; & Lt; TR & gt; & Lt; Th width = "39%" scope = "cluster" & gt; White list & lt; / Th & gt; & Lt; Th width = "61%" radius = "colonel" & gt; & Amp; Nbsp; & Lt; / Th & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; / Table & gt; & Lt; Div style = "max-height: 400px; overflow-y: auto" & gt; & Lt; Width of table = "100%" range = "0" cells = "0" cellpadding = "0" id = "list" & gt; & Lt; Tr class = "sub_head" & gt; & Lt; Td scope = "col" & gt; & Lt; Strong & gt; REG no. & Lt; / Strong> & Lt; / TD & gt; & Lt; Td scope = "col" & gt; & Lt; Strong> Student name & lt; / Strong> & Lt; / Td> & Lt; Td scope = "col" & gt; & Lt; Strong & gt; Grade & lt; / Strong> & Lt; / Td> & Lt; Td scope = "col" & gt; & Lt; Strong & gt; MESSAGE id & lt; / Strong> & Lt; / Td> & Lt; / TR & gt; & Lt; Tbody & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; / Div & gt; & Lt; Div id = "pagefuter" & gt; & Lt; Input type = "submit" name = "save_result" id = "save_result" value = "save result" / & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Form & gt;
and loads the load below from any other page
? & Gt; & Lt; Tr & lt ;? Php echo (($ x% 2)! = 0)? '': 'Class =' Optional-line line ''? & Gt; & Gt; & Lt; Td scope = "col" & gt; & Lt ;? Php echo $ learners ['reg_no'] ;? & Gt; & Lt; / Td> & Lt; Td scope = "col" & gt; & Lt ;? Php echo $ learners ['surname']. "". $ Learners ['full_names']. "(". $ Learners ['aliases']. ")"; ? & Gt; & Lt; / TD & gt; & Lt; Td scope = "col" & gt; & Lt ;? Php echo $ learners ['grd']. "$" Learners ['grade_section'] ;? & Gt; & Lt; / Td> & Lt; Td scope = "col" & gt; & Lt; Input name = "sms_id [& lt ;? php $ learners ['reg_no'] ;;> gt;]" type = "text" size = "3" /> & Lt; / TD & gt; & Lt; / TR & gt; & Lt ;? Php $ x ++;} while ($ learners = $ getLearners-> fetch ());
This code is within a form and below is a submit button for this it has been posted on a process.php, in which the following code, some print output
}
}
The form is posted directly from the process .fp
, Then it displays both values. I tried the following code and the following code of which Not just $ msg_id posting, but no other value.
var formData = $ ("# form1"). SerializeArray (); $ .ajax ({url: "Model / Process.php ", type:" post ", data: formadata, success: function (data) {warning (data);}});
this code is not working Can anyone help? Thanks in advance.
JDK
Actually, You are checking (Isset ($ _ POST ['submit']))
Ajax was not passing in your process.php
$ (' # Form1 '). SerializeArray ()
does not include data for the submit button.
Check the document here:
Your PHP code (process.php) should be changed to:
// If (isset ($ _ POST ['submit']) // // This will not be available when using .irializeArray (foreach) ($ _ POST ['sms_id'] as $ reg = & gt; $ msg_id] {echo $ Reg "/" $ Msg_id; } //}
Comments
Post a Comment