Hi all
So I downloaded a fully working PHP form, and dropped it into a website as a contact form. It is fully functional. However, my client wanted a “request a quote” form which had many more elements. I duplicated the PHP code from the working contact form, changed the IDs of the data appropriately, yet it does not work. The function will work fine with an error, but when I fill out the form correctly, it gives me a 500 server error. I don’t get it. I know enough coding to play with the PHP, but apparently I’m missing a key detail. I’ll include the code.
[php]<?php
//Add your information here
$recipient = "[email protected]";
$successPage = “index.html”;
//import form information
$name = $_POST[‘name’];
$phone = $_POST[‘phone’];
$email = $_POST[‘email’];
$company = $_POST[‘company’];
$type = $_POST[‘type’];
$features = $_POST[‘features’];
$deliverydate = $_POST[‘deliverydate’];
$deliveryaddress = $_POST[‘deliveryaddress’];
$edeliver = $_POST[‘edeliver’];
$completiondate = $_POST[‘completiondate’];
$siteaddress = $_POST[‘siteaddress’];
$message = $_POST[‘message’];
$name=stripslashes($name);
$phone=stripslashes($phone);
$email=stripslashes($email);
$company=stripslashes($company);
$type=stripslashes($type);
$features=stripslashes($features);
$deliverydate=stripslashes($deliverydate);
$deliveryaddress=stripslashes($deliveryaddress);
$edeliver=stripslashes($edeliver);
$completiondate=stripslashes($completiondate);
$siteaddress=stripslashes($siteaddress);
$message=stripslashes($message);
$message= “Name: $name, \n\n Message: $message”;
/*
Simple form validation
check to see if an email and message were entered
*/
//if no message entered and no email entered print an error
if (empty($name) || empty($phone) || empty($email) || empty($type) || empty($completiondate) || empty($deliverydate) || empty($siteaddress)){
print “One or more required fields have been left blank.
Please review your submission”;
}
//if the form has both an email and a message
else {
//mail the form contents
mail( “$recipient”, “$subject”, “$message”, “From: $email”, “$type”, “$features”, “$siteaddress”, “$completiondate”, “$deliverydate”, “$deliveryaddress”, “$edeliver”);
header(“Location: $successPage”);
}
?>[/php]
[code]
Name
Phone
Company (optional)
Type
<input type="radio" name="type" id="type" value="residential" placeholder=""> New Residential
<label style="color:white">_</label>
<input type="radio" name="type" id="type" value="commercial" placeholder=""> Commercial
<label style="color:white">_</label>
Remodel
_
Features
Kitchen
<label style="color:white">|</label> <input type="checkbox" name="features" id="features" value="bath" placeholder=""> Bath
<label style="color:white">/</label> <input type="checkbox" name="doors" id="features" value="doors" placeholder="" > Doors
<label style="color:white">/</label><input type="checkbox" name="tops" id="tops" value="tops" placeholder=""> Tops
<label style="color:white">|</label>
Hardware
</div>
</div><br>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label>Plan Delivery Date <i>(mm/dd)</i></label>
<input class="form-control" name="deliverydate" id="deliverydate" placeholder="" type="text" required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Plan Delivery Address <i>(if applicable)</i></label>
<input class="form-control" name="deliveryaddress" id="deliveryaddress" placeholder="" type="text">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<br><input type="checkbox" name="edeliver" id="edeliver" value="edeliver" placeholder=""> Electronic Delivery
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label>Estimated Completion <i>(mm/dd)</i></label>
<input class="form-control" name="completiondate" id="completiondate" placeholder="" type="text" required>
</div>
</div>
<div class="col-md-8">
<div class="form-group">
<label>Job Site Address</label>
<input class="form-control" name="siteaddress" id="siteaddress" placeholder="" type="text" required>
</div>
</div>
</div>
<br>
<div class="form-group">
<label>Message</label>
<textarea class="form-control" name="message" id="message" placeholder="" rows="8"></textarea>
</div>
<div><br>
<button class="btn btn-primary" type="submit">Submit</button><br>
</div>
</form>[/code]