Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Php form script assistance

New Here ,
Jul 14, 2009 Jul 14, 2009

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!";

}

?>

TOPICS
Server side applications

Views

422
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jul 14, 2009 Jul 14, 2009

Copy link to clipboard

Copied

Have you confirmed that php is running on your server?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 14, 2009 Jul 14, 2009

Copy link to clipboard

Copied

LATEST

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?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines