Jump to content

Feedback Form


larissahn

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.