I personally don’t have a GoDaddy account but some customers I build web sites for do and eventually I ran into an issue where my forms went completely dead on their servers. So if you use GoDaddy one thing you may eventually end up noticing is that certain forms you create may not work or find yourself having a hard time trying to fix the issue. Let me shine some light on this subject that not many seem to understand or be able to fix.
GoDaddy has a limit of up to 1,000 emails at any given time on any forms you may create, so that’s something to keep in mind. And like Yahoo and other picky web hosts, GoDaddy does not want you to mess around with the headers of a PHP mail form.
To start off, your form can be as big and/or as complicated as you’d like. The tricky part is to submit that data through to the next page and actually send the data. So here is a code for a simple contact form, please note the form method = post and where it’s being sent:
contact.php page
<form method="post" action="send_message.php">
<?php $ipi = getenv("REMOTE_ADDR"); ?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="50%"><strong>Full Name*:</strong></td>
<td width="50%"><strong>Email*:</strong></td>
</tr>
<tr>
<td><input name="full_name" type="text" id="full_name" size="25" /></td>
<td><input name="email" type="text" id="email" size="25" /></td>
</tr>
<tr>
<td><strong>Message*:</strong></td>
<td align="center"> </td>
</tr>
<tr>
<td colspan="2"><textarea name="message" id="message" cols="50" rows="10"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" id="submit" value="Send Message" /></td>
</tr>
</table>
</form>
Okay so that’s easy enough, now you need to create the page that submits the data and so here is a code that WILL work under your GoDaddy web site (of course this entire form and code also works on any other web server/host just as easily):
send_message.php page
<?
// Just some stats – Date and IP Address of Sender
$todayis = date("l, F j, Y, g:i a") ;
$ip = getenv("REMOTE_ADDR");
// Grab data from form
$full_name = $_POST['full_name'];
$email = $_POST['email'];
$message = $_POST['message'];
// Validation, if empty fields then return error message
if (empty($full_name) || empty($email) || empty($message))
{
?>
<center><font size="+2"><strong>Error!</strong></font></center><br />
Message has <strong>not</strong> been sent because you are missing one or more required fields.
<br />
You must go back and fill out all require fields!
<?
}
// Otherwise send the message!
else {
echo "center><font size=\"+3\"><strong>Success!</strong></font></center><br /><br />Thank you, your message has been successfully sent!";
mail("your@email.com", "Web Site Message!",
"On $todayis,
The following information was submitted!
———————————————————
Full Name: $full_name
Email: $email
Message: $message
——————–
IP Address: $ip");
}
?>
It’s a simple, yet effective way to send forms in GoDaddy. Don’t forget, you cannot use any headers on the form otherwise it will bounce to either an error page or to the success page but without actually sending any data to the e-mail address specified. Thanks for reading!
I signed up to your rss feed! Will you post more about this subject?