Jump to content

Recommended Posts

Hi, I recently created a simple form for my website, http://www.utilaecology.org/research/lionfish_contact.php

the feedback should be sent to my email, but I am not receiving anything.

<?php
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$date = $_REQUEST['date'] ;
$dive_site = $_REQUEST['dive_site'] ;
$depth = $_REQUEST['depth'] ;
$additional_information = $_REQUEST['additional_information'] ;

if (!isset($_REQUEST['email'])) {
    header( "Location: http://www.utilaecology.org/contact/response.php" );
    }
  elseif (empty($email) || empty($dive_site)) {
  header( "Location: http://www.utilaecology.org/contact/response.php" );
  }
  else {
  mail ( "[email protected]", "Report Lionfish Sighting Form", 
  "Date: $date\n", 
  "Dive Site Location: $dive_site\n", 
  "Depth: $depth\n",
  "Additional Information: $additional_information\n", 
  "From: $name <$email>" ) ;
  
  header ( "Location: http://www.utilaecology.org/contact/response.php" ) ;
  }
?> 

 

 

Link to comment
https://forums.phpfreaks.com/topic/160095-feedback-form/
Share on other sites

i think you have added to many parameters to the mail function

 

it should follow the format shown here:

http://au.php.net/manual/en/function.mail.php

 

try this


$message =  "Date: ".$date."\r\nDive Site Location: ".$dive_site."\r\nDepth: ".$depth."\r\nAdditional Information:". $additional_information."\r\n";

mail ( "[email protected]", "Report Lionfish Sighting Form", $message, "From: ".$name." <".$email.">" ) ;

Link to comment
https://forums.phpfreaks.com/topic/160095-feedback-form/#findComment-844681
Share on other sites

 

 

You are redirecting all statements to

http://www.utilaecology.org/contact/response.php

 

Try this and see if you can tell if it's going though the whole IF statement.

 


<?php
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$date = $_REQUEST['date'] ;
$dive_site = $_REQUEST['dive_site'] ;
$depth = $_REQUEST['depth'] ;
$additional_information = $_REQUEST['additional_information'] ;

if (!isset($_REQUEST['email'])) {
    
echo "No email entered";
    }
  elseif (empty($email) || empty($dive_site)) {

echo "Else If Statement";
  }
  else {
  mail ( "[email protected]", "Report Lionfish Sighting Form", 
  "Date: $date\n", 
  "Dive Site Location: $dive_site\n", 
  "Depth: $depth\n",
  "Additional Information: $additional_information\n", 
  "From: $name <$email>" ) ;
  
echo "Everything is good here"; 
  }
?> 


Link to comment
https://forums.phpfreaks.com/topic/160095-feedback-form/#findComment-844682
Share on other sites

thank you, followed both your suggestions. does anybody know for the date option what code I'd need to display a popup showing a calendar? thank you.

this is my new code:

<?php
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$date = $_REQUEST['date'] ;
$dive_site = $_REQUEST['dive_site'] ;
$depth = $_REQUEST['depth'] ;
$additional_information = $_REQUEST['additional_information'] ;

$message =  "Date: ".$date."\r\nDive Site Location: ".$dive_site."\r\nDepth: ".$depth."\r\nAdditional Information:". $additional_information."\r\n";

if (!isset($_REQUEST['email'])) {
    echo "No email entered." ;
}
  elseif (empty($email) || empty($dive_site)) {
         echo "Else If Statement";
  }
  else {
  mail ( "[email protected]", "Report Lionfish Sighting Form", $message, "From: ".$name." <".$email.">" ) ;
  
  header ( "Location: http://www.utilaecology.org/contact/response.php" ) ;
  }
  
?>

Link to comment
https://forums.phpfreaks.com/topic/160095-feedback-form/#findComment-844696
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.