Guest User

Untitled

a guest
May 21st, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <form method="GET" id="getForm">
  2. <p>First Name <input type="text" name = "firstName" size="20"/></p>
  3. <p>Last Name <input type="text" name = "lastName" size="20"/></p>
  4. <button type = "submit" name="submit">Register</button>
  5. </form>
  6.  
  7. <script>
  8. var xHRObject = new XMLHttpRequest();
  9. document.getElementById('getForm').addEventListener('submit', retrieveInformation);
  10. function retrieveInformation(e)
  11. {
  12. e.preventDefault();
  13. xHRObject.open("GET", "php/register.php", true);
  14. xHRObject.onreadystatechange = function() {
  15. if (xHRObject.readyState == 4 && xHRObject.status == 200)
  16. document.getElementById('information').innerHTML = xHRObject.responseText;
  17. }
  18.  
  19. xHRObject.send(null);
  20. }
  21. </script
  22.  
  23. if(isset($_GET['submit'])){
  24. $firstName = $_GET['firstName'];
  25. $lastName = $_GET['lastName'];
  26.  
  27. echo $firstName;
  28. }
Add Comment
Please, Sign In to add comment