Email spamming issues
Posted: Thu Jan 31, 2008 2:02 pm
I am currently writing a site with a form for submitting information to an email. I switched to php for the versatility of the variables and I've had issues with multiple blank forms being sent to said email. The template i laid out used to come back with teh pre-set text already on it but no input information every time someone visited the site or 3 times if they actually submitted it. I fixed the problem using an "If(isset($submit))" line to ensure that it would not be sent every time someone looked at the page. My only problem now is that when the submit button is actually hit it sends the form and a blank one. I have no idea how the code looks to send 2 emails in the first place, let alone one of them being blank.
My second issue is error checking. Im a novice at php and I found out that I am unable to request a seperate dialog box to confirm and/or error check the information. To prevent spammers or accidents I would like a set of code to display whether any given field is "" and if so, request the user to fill out that portion.
Any suggestions?
Code: Select all
<?php$nameF = $HTTP_POST_VARS['nameF'];
$nameL= $HTTP_POST_VARS['nameL'];
$email= $HTTP_POST_VARS['email'];
$year = $HTTP_POST_VARS['year'];
$GPA = $HTTP_POST_VARS['GPA'];
$phone = $HTTP_POST_VARS['phone'];
$hths = $HTTP_POST_VARS['hths'];
$hear = $HTTP_POST_VARS['hear'];
$frat = $HTTP_POST_VARS['org'];
$activity = $HTTP_POST_VARS['activity'];
$question = $HTTP_POST_VARS['question'];
$school = $HTTP_POST_VARS['school'];
if(isset($Submit))
{
$to = "someone@somewhere.com";
$subject = "Recruitment";
$body = "Name: $nameL,
$nameF \n
Email: $email \n
Year: $year \n
GPA: $GPA \n
Phone: $phone \n
Hometown/Highschool: $hths \n
How he heard about said organization: $hear \n
Why he wants to be in the organization: $org \n
What activities he is in: $activity \n
Questions or Comments he has: $question"; mail($to, $subject, $body);
}
?>
//code for the rest of the site
<form action="organizationreg.php" method="post" textalign=center>
//code for the form
<br /><input name="Submit" type="submit" class="input" value="Send" />
</form>Any suggestions?