Copy link to clipboard
Copied
Hello please forgive me as I am new to this but really need assistance. I have a form created in html on a site and have tried numerous tutorials on creating a php script which would be linked to this html form, but each one I try either doesn't work or it seems as if it goes through but then I never recieve the mail in my mailbox. I used my yahoo account as well as another account and didn't get anything , can anyone please assist as to what I should do here is what I have so far.
Thank you in advance for any assistance provided.
HTML:
<form name="contactform" method="post" action="mailer.php">
Name <input type="text" name="name"/><br/><br/>
Email <input type="text" name="email"/><br/><br/>
Address <input type="text" name="address"/><br/><br/>
City <input type="text" name="city"/><br/><br/>
When to Contact <select name="dropdown">
<option value="Morning">Morning</option>
<option value="Afternoon">Afternooon</option>
<option value="Evening">Evening</option>
</select><br/><br/>
Purpose of Contact <br/><textarea name="commment" rows="6" cols="40">
</textarea><br/> <br/><input type="submit" value="Submit Form Now" name="submit"/>
</form>
Here is the script that I am using :
<?php
if(isset($_POST['submit'])) {
$to = "john@yahoo.com";
$subject = "Inquiry Form";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$address_field = $_POST['address'];
$city_field = $_POST['city'];
$comment= $_POST['comment'];
$dropdown = $_POST['dropdown'];
foreach($_POST['check'] as $value) {
$check_msg .= "Checked: $value\n";
}
$body = "From: $name_field\n E-Mail: $email_field\n $check_msg Option: $option\n Drop-Down: $dropdown\n Message:\n $message\n";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "Form not Submitted!";
}
?>
Copy link to clipboard
Copied
Have you confirmed that php is running on your server?
Copy link to clipboard
Copied
Hello thank you for responding... yes I believe it is , I have used a drag and drop flash component with a php script for another project I had worked on not too long ago and it worked fine. Im pretty sure it is running.
Does the code and script that I provided look correct to you?