I'm having a problem with my php feedback form, i've searched everywhere and to no avail...
The Problem: as soon as a user goes on my 'Feedback form' webpage I immediately receive a blank email (before they even have a chance to look and input anything)....and when they fill out their info/feedback and click on SEND, I receive another email with their info (which is what I want). So why do I get that initial blank email? Here's the php script (what's wrong with it)?
<?php
//Destination Email ID
$to = "myemailaddress";//Name of the Person
$namenew = $_GET['name'];
//Email Id of the person
$emailnew = $_GET['email'];//Feedback detail
$feedbacknew = $_GET['feedback'];//Subject line of the email
$subject = "Feedback Form";/*********** Email body *******************/
$matter = "Below are the details filled by"." "."$namenew"."\n\n".
"Name:"." "."$namenew"."\n\n".
"Email:"." "."$emailnew"."\n\n".
"Suggestion:"." "."$feedbacknew"."\n\n";
/**********************************************/mail("$to","$subject","$matter","From: mywebsite.com");
?>
tnan,
I can't determine anything from the code you posted. That's the PHP file that sends the e-mail, but you said it works fine after the user has pressed "Send". Where's the code for the "Send" button (the "feedback form")?
Stephen
"Live long and PROGRAM......or at least do _something_ with all that time...!"
thanks for your reply...
the feedback form was done through flash mx...but i don't think thats the problem because i would still recieve an email (even without a feedback form including) in other words if you go on the blank form.php page it will still send me an email (weird)...i'm racking my brain wandering if there's something in the php code that signifies sending the email immediately...i'm stumped!
tnan-
As you've discovered, that PHP code is run every time the page is accessed - whether somebody filled out the form or whether they're just looking at it.You can do one of two things: Separate the feedback form (an html file that contains the flash control) out from the mailing php file you posted above into separate files, or do a test in the php code to see if the form was filled out before sending the e-mail.
Something like:
<?php
if (isset($_GET['name']))
{
//your code here
}
?>Good luck,
-SN
| « Blog and Gallery Software | making javascript libs? » |
Get Solutions to your Hi-Tech Issues Now!