Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="GET" id="getForm">
- <p>First Name <input type="text" name = "firstName" size="20"/></p>
- <p>Last Name <input type="text" name = "lastName" size="20"/></p>
- <button type = "submit" name="submit">Register</button>
- </form>
- <script>
- var xHRObject = new XMLHttpRequest();
- document.getElementById('getForm').addEventListener('submit', retrieveInformation);
- function retrieveInformation(e)
- {
- e.preventDefault();
- xHRObject.open("GET", "php/register.php", true);
- xHRObject.onreadystatechange = function() {
- if (xHRObject.readyState == 4 && xHRObject.status == 200)
- document.getElementById('information').innerHTML = xHRObject.responseText;
- }
- xHRObject.send(null);
- }
- </script
- if(isset($_GET['submit'])){
- $firstName = $_GET['firstName'];
- $lastName = $_GET['lastName'];
- echo $firstName;
- }
Add Comment
Please, Sign In to add comment