Hey guys,
I am working on my contact form for a site of mine (i am designing the form differently) that is for a child care, and I can't seem to get the form to connect with the php in order to get it to send verification to the user, send me a copy, and record it within a csv.
Here is the html form that goes on the page:
<form action="#" class="footer-form" action="contact.php">
<p class="title">Feel free to write some words</p>
<div class="form-group">
<input type="text" class="form-control" id="contactname" id="contact-name" placeholder="Your Name:">
</div>
<div class="form-group">
<input type="email" class="form-control" id="contactemail" id="contact-email" placeholder="Your E-mail:">
</div>
<div class="form-group">
<input type="phone" class="form-control" id="contactphone" id="contact-phone" placeholder="Your Phone Number:">
</div>
<div class="form-group">
<input type="child_info" class="form-control" id="child_info" id="contact-text" placeholder="Information About Child:">
</div>
<div class="form-group" style="border-removed 1px solid #e5e5e5;">
<input type="radio" id="female" name="female" value="female"> Female
</strong__^
</div>
<div class="form-group">
^__strong__^
<input type="age" id="age" class="form-control" id="contact-text" placeholder="Age of Child:">
</div>
<div class="form-group" style="border-removed 1px solid #e5e5e5;">
^__strong style="font: Raleway; color: #999; font-size: 16.5px;" id="specialneeds"__^Does Your Child Have Special Needs:
^__strong style="color: #888;">
<input id="yes"" type="radio" name="yes" value="yes">Yes
^__strong style="color: #888;">
<input id="no" type="radio" name="no" value="no"> No
</div>
<div class="form-group">
^__strong>
<input type="comment" class="form-control" id="message" id="contact-text" placeholder="Comments about service or if you want to add another child, write here:">
</div>
<button type="submit" class="btn btn-default waves-effect waves-button waves-float waves-classic">^__strong>Submit</button>
</form>
and php is this:
<?php
$contactname = $_POST["contact-name"];
$contactemail = $_POST["contact-email"];
$contactphone = $_POST["contact-phone"];
$child_info = $_POST["child_info"];
$gender = $_POST["gender"];
$age = $_POST["age"];
$specialneeds = $_POST["specialneeds"];
$message = $_POST["message"];
$to = 'yahoo@gmail.com';
$subject = 'Contact Form Submission!';
$v1 = "
<html> <body> <style>
h1 {color:#000066;}
table {border:1px solid black; background: #e3f0ff;}
</style> <h1>Hello, this form has been submitted!</h1> <img src= 'logo1.png' /> <table rules='all' style='border-color: #ffb300;' cellpadding='10' width='500px'> <tr style='background: #ffb300;'><td>First Name: $name</td> <tr style='background: #fafafa;'><td>Email: $email</td> <tr style='background: #fafafa;'><td>Phone: $phone</td> <tr style='background: #fafafa;'><td>Child Gender: $gender</td> <tr style='background: #fafafa;'><td>Child's Age:: $age </td> <tr style='background: #fafafa;'><td>Child with Special Needs: $specialneeds</td> <tr style='background: #fafafa;'><td>More Information: $message</td> </table> </body> </html> ";
$message = $v1;
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
mail($to, $subject, $message, $headers);
echo "Message has been sent...";
echo $v1;
$contactname = $_POST["contact-name"];
$contactemail = $_POST["contact-email"];
$contactphone = $_POST["contact-phone"];
$child_info = $_POST["child_info"];
$gender = $_POST["gender"];
$age = $_POST["age"];
$specialneeds = $_POST["specialneeds"];
$message = $_POST["message"];
$subject = 'Message Confirmed!';
$v1 = "
<html> <body> <style>
#disclosure {font-size: 8px; color: #333;}
h1 {color:#000066;}
table {border:1px solid black;}
</style> <img src= 'logo1.png' /> <table rules='all' style='border-color: #ffb300;' cellpadding='10' width='500px'> <tr style='background: #ffb300;'><td>Email Confirmation <tr style='background: #fafafa;'><td>Hello $name, your message has been recieved! We will contact you shortly! <br><br>Best, <br>M<br>©M(TM) All Rights Reserved 2015 </div> </table> </body> </html> ";
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
mail($email, $subject, $message, $headers);
$count= count(file("main_form.csv"));
$today = date("d M Y h:i A");
echo $today;
echo $v1;
$cvsData = "\n" . $count . "," . $today . "," . $contactname . "," . $contactemail . "," . $contactphone . "," . $child_info . "," . $gender . "," . "," . $age . "," . $specialneeds . "," . $message;
$fp = fopen("main_form.csv", "a" );
if($fp){
fwrite($fp, $cvsData);
fclose($fp);
}
?>