Basically what I am looking for is a way to have my contact form not only be sent to an email but also sent to be stored in a database.
Can this be done or can it only be one or the other?
Here is what my contact.php looks like as of right now.
<?php // Pick up the form data and assign it to variables $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $phone = $_POST['phone']; $email = $_POST['email']; $city = $_POST['city']; $state = $_POST['state']; $hear_about = $_POST['hear_about']; $inquiry = $_POST['inquiry']; $address = $_POST['address']; $message = $_POST['message']; // Build the email (replace the address in the $to section with your own) $to = 'email@example.com'; $subject = "Submission from IPS Website: $topic"; $message = "$name Name: $first_name $last_name\ Phone: $phone\ Email: $email\ From: $address $city, $state\ Heard from: $hear_about\ Inquiring for: $inquiry\ Message: $message"; $headers = "From: $email"; // Send the mail using PHPs mail() function mail($to, $subject, $message, $headers); // Redirect header("Location: success.html"); ?>
Any help would be appreciated.