Jump to content


PHP Contact Form


2 replies to this topic

#1 nld

    Young Padawan

  • Members
  • Pip
  • 32 posts

Posted 06 July 2007 - 09:59 PM

Hi I've tried various contact forms even the one in the tutorials on the forum, but it keeps giving me this error about "no email address entered" Can anyone please write an efficient contact form tutorial using php and forms.

Just a simple one, please include just 3 fields name, subject, and comments
and one more feature that when submitted it emails it to my email address,
-also it should be able to detect if fields are left empty and send you back to fill them.

Just a little help is all I'm asking.

Thanks,

Lucky

#2 Nike

    Young Padawan

  • Members
  • Pip
  • 204 posts
  • Location:Ohio
  • Interests:Controlling the human and and duck race.

Posted 07 July 2007 - 01:11 AM

This isn't really a tutorial but this is my code.
contactme.php
<?PHP
#Whatever your email is.
$to = "quarterpint261@gmail.com";

#This is our subject.
$re = "Pie Jokes fan";

#This is our option box.
$pl = "Joke type: $decision";

#The message of the form.
$msg = "$name
$email
$comments";

#Sends the mail. Only mess with if adding another feature.
mail($to,$re,$msg,$pl);
?>

Yourpage.com
<table align="center">
<tr>
<form action="contactme.php" mehod="post">
<td align="right"><b><font size="1" face="Verdana">Name: </font></td><td><input type="text" name= "name" size="40"/></td>
</tr>
<tr>
<td align="right"><b><font size="1" face="Verdana">Email:</font></td><td> <input type="text" name="email" size="40"></td>
</tr>
<tr>
<td align="right"><b><font size="1" face="Verdana">Joke type:</font></td><td><select name="decision">
<option selected>Black<option>Blonde<option>Ethnic<option>Gay<option>Yo Mama
</select></td>
</tr>
<tr>
<td valign="top" align="right"><b><font size="1" face="Verdana">Message: </font></td><td><textarea name="comments" cols="30" rows="5"></textarea></td>
</tr>
<tr>
<td></td><td><input type="submit" value="Send Form" class="button2"> <input type="reset" value="Reset" class="button"></font></td>
</tr>
</table>

I'll be happy to awnser any of your questions.

#3 nld

    Young Padawan

  • Members
  • Pip
  • 32 posts

Posted 11 July 2007 - 07:35 PM

Dude thanks though I did have one question, um if this doesn't work does it mean there may be some problem with my host? It supports PHP i know, but safe mode is on, and I'm not sure what it settings are for mail. my host is www.freewebhostingpro.com and 12gbfree.com.

oh and how long does it take for u to recieve comments?

thanks

Edited by nld, 11 July 2007 - 07:59 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users