Jump to content

Emailing a form -- Help with this


Design

Recommended Posts

Here's the form/script that i'm using, but it wont work, please help me with this if you could.
[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
//Start Script
// Check to make sure that the user isnt spamming people via the form:
function spamcheck($field)
{

if(eregi("to:",$field) || eregi("cc:",$field))
  {
    return TRUE;
    }
  else
    {
    return FALSE;
  }
}
function checkType($type)
{
if($_REQUEST['type1'] = TRUE AND $_REQUEST['type2'] = FALSE)
{
$type = "1"
}
else if($_REQUEST['type1'] = FALSE and $REQUEST['type2'] = TRUE)
{
$type = "2"
}
else
{
$type= "3"
}
return $type;
}
//Make sure the form is filled out:
if(isset($_REQUEST['email']));
{
//check if the email address is invalid
$mailcheck = spamcheck($_REQUEST['email']);
if ($mailcheck==TRUE)
  {
  echo "Sorry, the e-mail you have entered is invalid, please re-enter it.";
  }
else
{
  //send email if the e-mail is valid
  $email = $_REQUEST['email'];
  $subject = "Smash Entry For: " . $_REQUEST['name'];
  $message = $_REQUEST['sname'] . ", " . $_REQUEST['char'] . ", " . checkType($type);
  mail("[email protected]", "Subject: $subject",
  $message, "From: $email" );
  echo "Thanks for your entry!Your data will be sent to the tournament staff.";
  }
}
else
{
echo "<h1 align='center'>Glenwood SSBM Tournament Form</h1><hr /><br /><h3 align='center'>Fill out the form and click the &quot;Send&quot; button.</h3>"
echo "<form method='post' action='ssbm.php'>
Email: <input type='text' name='email' /><br />
Name: <input type='text' name='name' /><br />
Smash Name: <input type='text' name='sname' max=4 min=1 size=16><br />
Character: <input type='text' name='char' /><br />
Entry Type(select at least one):<br />
One on One:<input type='checkbox' name='type1'><br />
Teams:<input type='checkbox' name='type2'><br />
</form>";
echo "<p><em>Note: In order to join the tournament, you will be required to pay an entry fee of    $5.00 upon entry.  This is mandatory for both teams and singles, meaning that if you are on a team,  you AND your partner will need to pay the entry fee, totalling ten dollars.  The same goes if you  were to enter in both tournaments, you would have to pay a fee of ten dollars(five for each            tournament).</em></p><br /><p><font size='2'>&copy;2006 By Tristan Nolan.</font></p>"
}
//End
}
?>
</body>
</html>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/24294-emailing-a-form-help-with-this/
Share on other sites

Here, you need to use == instead of =

[code]function checkType($type)
{
if($_REQUEST['type1'] == TRUE AND $_REQUEST['type2'] == FALSE)
{
$type = "1"
}
else if($_REQUEST['type1'] == FALSE and $REQUEST['type2'] == TRUE)
{
$type = "2"
}
else
{
$type= "3"
}
return $type;
}[/code]

Are you getting type1 and type2 from checkboxes?  radio buttons?

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.