I am learning Extjs along with PHP and MySQL for one of my web development course in college right now, and I am very close to finishing my final project for the class and I am stuck on something as simple as a checkbox. I am more into c# programming, so my c# mindset is clashing with the necessities of ExtJS.
The program asks hospital patients a vast amount of questions about their day-to-day feelings, and I have a list of Checkboxes for common symptoms and I need to be able to check to see, once they submit the form, which symptoms were checked and add that symptoms id to the symptoms array.
Is this even close?
if(headacheCheckbox.getValue()==true){
symptoms[headacheCheckbox.getId()];
}
on the Server Side I have
$id=$dbh->lastInsertId();
$symptom=$_REQUEST['symptoms'];
while($tmp=$symptom->fetch()){
$stmt=$dbh->prepare("insert into symptom_input (inputid, symptomid) values (?,?)");
$stmt->bindParam(1, $id);
$stmt->bindParam(2, $tmp);
$stmt->execute();
}
and I have my ajax request in my ExtJS taking in the symptom array as a parameter like so..
params: {action: 'create_input',
symptoms: symptoms[],
},
Absolutely any help/criticism is welcome.
Thank You!
This line
and this line
do not compute.
fecth is method ffor prepared statement object http://il2.php.net/manual/en/mysqli-stmt.fetch.php (when you fetchign a result set, similar to mysql_fecth_row for unprepared statements) while you have an array parsed to this variable
$symptom=$_REQUEST['symptoms'];So your fetch will throw an error in whileassuming that your array looks like this
what you need is something like this
Also when passing a parameters
assuming that code bellow is creating an array in your JavaScript
you need to