How would I go about showing the response from a submitted contact form (on the same page underneath the form) rather than sending the user to a new page after the submissio
You will need to use ajax for that. The simplest solution is to get jQuery
javascript library an use it's .post
function for which you can find documentation and examples here. In your case it will look something like this:
Also your PHP code is wrong:
$name =$_GET['name'];
$email =$_GET['name'];
$message =$_GET['name']
You are getting $_GET['name']
for all 3 variables.
edit:
I added a complete example but it is not tested it's just so you can have an idea how to do what you want. Also since this is using HTTP POST request, you will need to edit your PHP so it gets values $_POST
array, not $_GET
. Also you will need to add a where you want to display the response.