Note that there are some explanatory texts on larger screens.

plurals
  1. POGet all form values in javascript and send the values back to php page
    primarykey
    data
    text
    <p>i'm using Ajax way to process my Data so i have a lot of forms , and i did a check of the forms values using jquery , so i'm ok with the values types and all of validation staff .. now i'm wondering how to get all my values " i'm talking about 25 input ,, and send it to php page</p> <p>Example :</p> <pre><code>&lt;input type="text" name="emp_user_name" id="emp_user_name" PLACEHOLDER="User Name" /&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="password" name="pass" id="pass" /&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="password" name="pass2" id="pass2" /&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="text" name="emp_group" id="emp_gorup" PLACEHOLDER="Group" /&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="text" name="emp_ar_name" id="emp_ar_name" PLACEHOLDER="Employee Name" /&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="text" id="emp_en_name" style="direction:ltr!important;" id="emp_en_name" PLACEHOLDER="Full name" style="direction:ltr ;" /&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="text" id="emp_address" name="emp_address" PLACEHOLDER="Address" /&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="text" name="emp_num1" style="direction:ltr!important;" id="emp_num1" PLACEHOLDER="091" /&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="text" name="emp_num2" style="direction:ltr!important;" id="emp_num2" PLACEHOLDER="092" /&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="text" name="emp_email" style="direction:ltr!important;" id="emp_email" PLACEHOLDER="support@huemix.ly" /&gt;&lt;/li&gt; &lt;li style="padding: 39px;"&gt;Male : &lt;input type="radio" name="emp_sex" id="emp_sex" PLACEHOLDER="male" /&gt; Female : &lt;input type="radio" name="emp_sex" id="emp_sex2" PLACEHOLDER="female" /&gt; &lt;/li&gt; &lt;li&gt;&lt;input type="text" name="emp_bday" id="emp_bday" PLACEHOLDER="17/02/2011" /&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="submit" name="save" onclick="add_emps_to_db()" id="save" value="" /&gt;&lt;/li&gt; </code></pre> <p>this is one of my forms .. and this is the javascript function</p> <pre><code>function add_emps_to_db(){ nocashe = Math.random(); http.open('get','huemix_custom.php?section=emps&amp;action=add_new_emps_to_db&amp;" I Wanna Data Here"&amp;nocache = '+nocache); http.onreadystatechange = HuemixinsertReplay; http.send(null); </code></pre> <p>}</p> <p>I was using this way , but it's not flexible way to work with a lot of forms </p> <pre><code>var first_name= encodeURI(document.getElementById('first_name').value); var middle_name= encodeURI(document.getElementById('middle_name').value); var last_name= encodeURI(document.getElementById('last_name').value); var phone_num1= encodeURI(document.getElementById('phone_num1').value); var phone_num2= encodeURI(document.getElementById('phone_num2').value); var work_type= encodeURI(document.getElementById('work_type').value); var work_place= encodeURI(document.getElementById('work_place').value); var from= encodeURI(document.getElementById('from').value); var worktype1 = $("#worktype1").is(':checked')?1:0; var worktype2 = $("#worktype2").is(':checked')?1:0; var worktype3 = $("#worktype3").is(':checked')?1:0; var site_name= encodeURI(document.getElementById('site_name').value); var start_date= encodeURI(document.getElementById('start_date').value); var end_date= encodeURI(document.getElementById('end_date').value); var site_url= encodeURI(document.getElementById('site_url').value); var script_type= encodeURI(document.getElementById('script_type').value); var last_mod= encodeURI(document.getElementById('last_mod').value); var cpanel_url= encodeURI(document.getElementById('cpanel_url').value); var cpanel_user= encodeURI(document.getElementById('cpanel_user').value); var cpanel_pass= encodeURI(document.getElementById('cpanel_pass').value); var adminpanel_url= encodeURI(document.getElementById('adminpanel_url').value); var adminpanel_user= encodeURI(document.getElementById('adminpanel_user').value); var adminpanel_pass= encodeURI(document.getElementById('adminpanel_pass').value); var other_url= encodeURI(document.getElementById('other_url').value); var other_user= encodeURI(document.getElementById('other_user').value); var other_pass= encodeURI(document.getElementById('other_pass').value); var ftp_url= encodeURI(document.getElementById('ftp_url').value); var ftp_user= encodeURI(document.getElementById('ftp_user').value); var ftp_pass= encodeURI(document.getElementById('ftp_pass').value); var support= $("#support").is(':checked')?1:0; var support_end_date= encodeURI(document.getElementById('support_end_date').value); var id= $(this).closest("td").find("#huemix_id").value; var notes = encodeURI(document.getElementById('notes').value); </code></pre> <p>i wanna foreach loop for example .. or any way to add the input field Id + input field value ,, and add all of this to my link automatic ,, </p> <p>Example : i wanna my link be like this </p> <pre><code>huemix_custom.php?section=emps&amp;action=add_new_emps_to_db&amp;id_for_virst_input=value_for_first_input&amp;id_for_second_input=value_for_second_input... and goes on this way&amp;nocache = '+nocache </code></pre> <p>Note : as you see i have 3 types , Input type Text , Password And Radio </p> <p>Thanx by the way</p>
    singulars
    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.
 

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