Jump to content

Form not sending mail


captain20bucks

Recommended Posts

Hey, I have been working on this form for my website and it initially worked and sent me my form information before I added the if statements, but now it wont send anything. I tried it again without the if statements i put in and it still doesnt want to work. I know my server can send mail though otherwise it wouldnt have sent the first few times. Heres the script for my form...

<form name="orderform" method="POST" action="mail.php" valign="center">
<table width="531" border="0" cellspacing="5">
<tr>
<td colspan="5"><b><u><br>Happy Films Order Form:</u></b><br></td>
</tr>
<tr>
<td colspan="5">I would like to
<select name="select" value="$select">
<option value="order">Order</option>
<option value="preorder">Preorder</option>
</select>
<a href="order_help.html"><font size="1">help</font></a>
a
<select name="what_to_buy" onClick="workbitch()">
<option value="0" selected="selected"><---Select Item --->
<option value="shirt">T-Shirt $10
<option value="shirt+secondseason">T-Shirt+ 2ndDVD $15
<option value="firstseason">1st Season DVD $5
<option value="secondseason">2nd Season DVD $10
</select>
<font color="red" size="2">Required</font></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2"><div id="shirtsstuff" CLASS="color_size" style="visibility:hidden">
Size: <select name="size" value="$size">
<option value="small">sml</option>
<option value="medium">med</option>
<option value="large">lrg</option>
</select>
Color: <select name="color" value="$color" size="1">
<option value="ash">ash</option>
<option value="azalea">azalea</option>
<option value="banana">banana</option>
<option value="black">black</option>
<option value="burgundy">burgundy</option>
<option value="chocolate">chocolate</option>
<option value="denim">denim</option>
<option value="duskpurple">dusk purple</option>
<option value="forest">forest</option>
<option value="gold">gold</option>
<option value="heathr">heathr</option>
<option value="jade">jade</option>
<option value="kelly">kelly</option>
<option value="khaki">khaki</option>
<option value="lightblue">light blue</option>
<option value="natural">natural</option>
<option value="navy">navy</option>
<option value="orange">orange</option>
<option value="pacificblue">pacific blue</option>
<option value="pink">pink</option>
<option value="purple">purple</option>
<option value="red">red</option>
<option value="royalblue">royal blue</option>
<option value="stone">stone</option>
<option value="white">white</option>
<option value="yellow">yellow</option>
</select>
<a href="colors.html"><font size="1">colors</font></a>
</div></td>
<td> </td>
</tr>
<tr>
<td width="6"> </td>
<td width="125">Name:</td>
<td><input name="name" type="text"></td>
<td> <font color="red" size="2">Required</font></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>Address:</td>
<td colspan="3"><input name="address" type="text" size="40"></td>
</tr>
<tr>
<td> </td>
<td>State:</td>
<td colspan="3"><input name="state" type="text" ></td>
</tr>
<tr>
<td> </td>
<td>City:</td>
<td colspan="3"><input name="city" type="text"></td>
</tr>
<tr>
<td> </td>
<td>Zip:</td>
<td colspan="3"><input name="zip" type="text" maxlength="5" size="5"></td>
</tr>
<tr>
<td> </td>
<td>Email Address:</td>
<td width="236"><input name="email" type="text"></td>
<td width="61"> <font color="red" size="2">Required</font></td>
<td> </td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="5">Means of Paying, or Other information/Questions<br><br>
<center>
<textarea name="addinfo" value="$addinfo" rows="5" cols="60"></textarea>
</center></td>
</tr>
<tr>
<td colspan="2" align="right"> </td>
<td colspan="3" align="right"> </td>
</tr>
<tr>
<td colspan="2" align="right"> </td>
<td colspan="2" align="right"><input type="submit" name="submit" value="Send"></td>
<td width="63" align="right"> </td>
</tr>
</table>
</form>

Then here is my mail.php

<?php
@extract($_POST);
$name = stripslashes($name);
$email = stripslashes($email);
$select = stripslashes($select);
$size = stripslashes($size);
$color = stripslashes($color);
$what_to_buy = stripslashes($what_to_buy);
$address = stripslashes($address);
$state = stripslashes($state);
$city = stripslashes($city);
$zip = stripslashes($zip);
$addinfo = stripslashes($addinfo);
$to = "Happy Films <happy_films@hotmail.com>";
$from = "From: The Orderform <happy_films@hotmail.com>";
$stupid = "";
$stupid2 = "";
$stupid3 = "";
$error = false;
$wrongemail = "A valid email address is required for ordering";
$noitem = "Please select an item to Purchase";
$noname = "Please put in your name";
$congrat = "Congratulations, your order has been sent!\r\nYou can expect a response within 24 hours.";
$message="$name just filled in your order form.\r\ne-mail = $email.\r\nThey would like to $select a $size $color$what_to_buy.\r\n$address\r\n$state\r\n$city\r\nzip\r\nAdditional Information: $addinfo . \r\n";
$message = wordwrap($message, 70);
$send = mail($to, 'Orderform', $message, $from);

function check_email($str)
{
if(ereg("^.+@.+\..+$", $str))
{
return 1;
}
else
{
return 0;
}
}
if(!check_email($email))
{
$stupid = $wrongemail;
$error = true;
}
if ($name == "")
{
$stupid2 = $noname;
$error = true;
}
if ($what_to_buy == "0")
{
$stupid3 = $noitem;
$error = true;
}
if ($error == false)
{
$stupid = $congrat;
$send;
}
?>

<table width="531" border="0" cellpadding="10">
<tr>
<td><div align="center"><font size="4"><? print($stupid); ?></font></div></td>
</tr>
<tr>
<td><div align="center"><font size="4"><? print($stupid2); ?></font></div></td>
</tr>
<tr>
<td><div align="center"><font size="4"><? print($stupid3); ?></font></div></td>
</tr>
</table>

The error messages work fine and all that, I just need help in why my message isnt being sent.
Link to comment
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.