Send form data via php?

rager

New Member
The form action is "" because it all uses the same page. Is there anyway the form can submit on the same page without refreshing?PHP:\[code\]<?php if ($_SERVER['REQUEST_METHOD'] == 'POST'){ $to="[email protected]"; $subject="Tech Muffins Contact"; $message="Name: ".$_REQUEST['name']."\n\nEmail: ".$_REQUEST['email']."\n\nMessage: ".$_REQUEST['message']; $from = "[email protected]"; $headers = "From:" . $from; mail($to, $subject, $message, $headers );}?>\[/code\]HTML:\[code\]<form id="contactform" action="" method="post" autocomplete="off"> <input type="text" name="name" placeholder="name" autofocus required> <input type="email" id="email" name="email" placeholder="email" required> <textarea name="message" placeholder="message" required></textarea> <input type="submit" value="http://stackoverflow.com/questions/15560944/submit"></form>\[/code\]
 
Back
Top