1 Star2 Stars3 Stars4 Stars5 Stars (14 votes, average: 5.00 out of 5)

Ajax How To Process More Than One Form Item

Ajax Scripts

Make an index.php file and put the following lines of code in it.

<title>Ajax Process More than one form item.</title> 
<input type="email" id="email" size="50" placeholder="Email Address"> 
<input type="text" id="name" size="50" placeholder="Name"> 
<button type="button" id="subsub" onclick="ajax_post();">GO</button><br/> <div id="status"></div> 
function ajax_post(){ 
 var hr = new XMLHttpRequest(); 
 var url = "processor.php"; 
 var emm = document.getElementById("email").value; 
 var name1 = document.getElementById("name").value; 
 var vars = "email="+emm+"&namee="+name1; 
 hr.open("POST", url, true); 
 hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
 hr.onreadystatechange = function() 
 { if(hr.readyState == 4 && hr.status == 200) { 
 var return_data = hr.responseText; document.getElementById("status").innerHTML = return_data; 
hr.send(vars); // After Check Steps are done execute the request
 document.getElementById("status").innerHTML = "processing..."; } </script> 

Now make a processor.php file and put these lines of code in it. It is important to note that you must do this on a computer or server that has a PHP processor on it.

Tip: Click on images to make them larger. If you find anything wrong on this page or need further assistance please comment below or contact me. 🙂
<?php if(isset($_POST['email'])){ $email=$_POST['email']; $name=$_POST['namee']; echo 'the email is '. $email.' The name is '.$name; }; ?>


Ajax How To Process More Than One Form Item was last modified: June 11th, 2017 by Maximus Mccullough

Subscribe To My YouTube Channel:

Please like, share and subscribe.

Advanced Programming Made Easy

I hope you enjoyed the article. If I was able to help you please consider a tip for the content.

One Time Tip

more tips

Reoccuring Tips


Cool People Share:
Ajax How To Process More Than One Form Item

Pages:Previous 1 2

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.