Quote form help


#1

I have a form that has a few issues and looking for help. The form submits and pops up a message saying the form was submitted successfully, but the fields in the form still have data in them. I need some help with that function of the form. The other issue is with the form-select options not being sent along with the email. That part shows up blank. Any help is much appreciated.

HTML CODE:
[embed=425,349]

Request a Quote


<div class=“form-select” id=“service-select”">

Select Service
Real Estate
Inspections
Insurance
Video





<textarea name=“message” id="" cols=“30” rows=“5” name="message "placeholder=“Message” class=“form-control”>
Request Free Quote
[/embed]

PHP CODE:
[php]<?php
$service = $_POST[‘service’];
$name = $_POST[‘name’];
$phone = $_POST[‘phone’];
$email = $_POST[‘email’];
$message = $_POST[‘message’];
$formcontent=“From: $name \n service: $service \n phone: $phone \n Message: $message”;
$recipient = "myemail@address.com";
$subject = “my subject info”;
$mailheader = “From: $email \r\n”;
mail($recipient, $subject, $formcontent, $mailheader) or die(“Error!”);
echo "";
?>[/php]


#2

Before I really respond, how many forums are you hitting up for this? And have they responded?


#3

This is the first forum that i posted on with my issue. Im self tough so i tend to get confused on some things.


#4

First thing first, your select doesn’t have a name attribute. That is what the $_POST goes off of for the keys. That is why that value doesn’t come through.

The mail() function is not reliable at all. Previously I used PHPMailer, but now I use MailGun for all my mail submissions. You obviously can use either, or there is also SwiftMail that others like.

For the form not resetting, drop the history - 1 piece, just redirect back to the form on success or use what you are currently doing on failure.


#5

Thanks astonecipher, i will give that a try and report back later.


#6

Giving the select a name will resolve one of the issues.

With regards to the redirect, a quick way to do this is to perhaps just use php’s header() function to send user to whatever page you want. Something like:

[php]header(“Location: blah.php”);
exit;[/php]

You could even attach a get parameter to it… blah.php?message=Thank You then use $_GET[‘message’] on the receiving page and echo the output.

Good Luck,
Frank