Note that there are some explanatory texts on larger screens.

plurals
  1. POAJAX\JQUERY: Update MYSQL database with form data without refreshing
    primarykey
    data
    text
    <p>Ok, so I've gotten most of this thing done.. Now comes, for me, the hard part. This is untreaded territory for me. </p> <p>How do I update my mysql database, with form data, without having the page refresh? I presume you use AJAX and\or Jquery to do this- but I don't quite grasp the examples being given. </p> <p>Can anybody please tell me how to perform this task within this context? </p> <p>So this is my form:</p> <pre><code> &lt;form name="checklist" id="checklist" class="checklist"&gt; &lt;?php // Loop through query results while($row = mysql_fetch_array($result)) { $entry = $row['Entry']; $CID = $row['CID']; $checked =$row['Checked']; // echo $CID; echo "&lt;input type=\"text\" value=\"$entry\" name=\"textfield$CID;\" id=\"textfield$CID;\" onchange=\"showUser(this.value)\" /&gt;"; echo "&lt;input type=\"checkbox\" value=\"\" name=\"checkbox$CID;\" id=\"checkbox$CID;\" value=\"$checked\"".(($checked == '1')? ' checked="checked"' : '')." /&gt;"; echo "&lt;br&gt;"; } ?&gt; &lt;div id="dynamicInput"&gt;&lt;/div&gt; &lt;input type="submit" id="checklistSubmit" name="checklistSubmit" class="checklist-submit"&gt; &lt;input type="button" id="CompleteAll" name="CompleteAll" value="Check All" onclick="javascript:checkAll('checklist', true);"&gt;&lt;input type="button" id="UncheckAll" name="UncheckAll" value="Uncheck All" onclick="javascript:checkAll('checklist', false);"&gt; &lt;input type="button" value="Add another text input" onClick="addInput('dynamicInput');"&gt;&lt;/form&gt; </code></pre> <p>It is populated from the database based on the users session_id, however if the user wants to create a new list item (or is a new visitor period) he can click the button "Add another text input" and a new form element will generate. </p> <p>All updates to the database need to be done through AJAX\JQUERY and not through a post which will refresh the page. </p> <p>I really need help on this one. Getting my head around this kind of... Updating method kind of hurts! </p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload