joesaddigh Posted April 20, 2010 Share Posted April 20, 2010 Hi, I want to submit a form but not actually refresh the page. Is this possible? For example if I have this code below and the send_quote_as_enquiry.php is just a form which I populate certain values. I want to submit this without refreshing the page but make it trigger something so tha I can submit the details if necessary. //--------------------------------------------------------------------------------------------------------------- // Show the enquiry form include("send_quote_as_enquiry.php"); //--------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------- $j = false; if ( $j ) { // Insert the data //Get personal details from enrolment form $firstname = mysql_real_escape_string($_POST["first_name"]); $surname = mysql_real_escape_string($_POST["surname"]); $email = mysql_real_escape_string($_POST["email"]); $subject = mysql_real_escape_string($_POST["subject"]); $question = mysql_real_escape_string($_POST["question"]); // Insert enquiry data $query = "INSERT INTO enquiry(enquiry_id,email, subject, content, first_name, surname, date, replied) VALUES(0, '$email', '$subject', '$question', '$firstname', '$surname', NOW(), 'no')"; $result = mysql_query($query) or die("Error making contact"); } Thanks in advance Link to comment https://forums.phpfreaks.com/topic/199171-post-through-details-of-a-form-without-refreshing-a-page/ Share on other sites More sharing options...
seventheyejosh Posted April 20, 2010 Share Posted April 20, 2010 You can use ajax (javascript) to send the either individual values, or a serialization of the form. This is really the only way if the page isn't going to reload. Link to comment https://forums.phpfreaks.com/topic/199171-post-through-details-of-a-form-without-refreshing-a-page/#findComment-1045351 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.