Go Back   Free website templates > Web Template Help > PHP and MySQL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Join now to download all the free website templates or post on the forum. If you have never been on a forum before read the FAQ. It's quick, easy and free to join!
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-10-2008, 09:56 PM
vareside's Avatar
Senior Member
 
Join Date: Jul 2007
Posts: 254
vareside is on a distinguished road
Post PHP Mail Form

Hi folks,

during the last weeks I got a bit confused and busy due to school work. I would like to build a small e-mail-service where the user can send messages to an e-mail-adress of his/her choice.

The form should basically contain 5 fields.
1. Name
2. E-Mail (from)
3. E-Mail (to)
4. Subject
5. Message

And if it's possible, to prevent spam, an image-code you have to enter "to verify that you are a human".

Kind regards,
vareside
Reply With Quote
  #2 (permalink)  
Old 08-02-2009, 03:06 PM
Junior Member
 
Join Date: Aug 2009
Posts: 2
anishk177@gmail.com is on a distinguished road
Default

try www.thesitewizard.com
Reply With Quote
  #3 (permalink)  
Old 08-24-2009, 05:00 AM
bmcoll3278's Avatar
Moderator
 
Join Date: Jun 2009
Posts: 294
bmcoll3278 is on a distinguished road
Default

Easy script but you would open to big problems from spam unless it it password protected.

I will try to log in tomorrow and paste the code in for you but I would not use it unless you password protect the page
__________________
I hope to build a site with something for every body
www.bmcoll.com
Reply With Quote
  #4 (permalink)  
Old 08-24-2009, 07:29 AM
Junior Member
 
Join Date: Nov 2008
Location: Hyderabad - India
Posts: 4
dynamark is on a distinguished road
Default small time e-mail service to my registered viewers.

Hi friends,

I would also like to build a small e-mail-service where the user can send messages to an e-mail-address of their choice.

The form should basically contain 5 fields.
1. Name
2. E-Mail (from)
3. E-Mail (to)
4. Subject
5. Message
6. My Ad at the bottom in a text form

And if it's possible, to prevent spam, a special-code has to be entered "to verify that the sender is registered with us". If you get sufficient help do let me know the details of the same.

Kind regards,
dynamark
__________________
Looking Forward, DynaMark
Reply With Quote
  #5 (permalink)  
Old 08-26-2009, 04:29 AM
bmcoll3278's Avatar
Moderator
 
Join Date: Jun 2009
Posts: 294
bmcoll3278 is on a distinguished road
Default

Ok I can not do anything about making sure they are a member but you can place the script in a folder that can only be accessed buy a registered user.

I uploaded this to my site and tested it. It does work be sure to set the permissions to 755 on the files after you get them on your server.

code for the form
Code:
<div> <table width="60%"><tr><td>
<form method="post" action="send.php"onsubmit="return validate_form(this)">

Your Name: </td><td><input type="text"name="name"/></td><tr><tr><td>

Your Email: </td><td><input type="text"name="email"/></td><tr><tr><td>

Email your sending to: </td><td><input type="text"name="send"/></td><tr><tr><td>

Subject: </td><td><input type="text"name="subject"/></td><tr><tr><td>


Message:</td><td>
<textarea name="message" rows="10" cols="30">


</textarea></td></tr><tr><td>
<input type="submit" value="send message"/>
</form>
	</td></tr></table>		
		</div>
save this code as send.php

Code:
<?php 
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$send=$_REQUEST['send'];
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
  

$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields
  
  mail ("$send", "$subject", "$message","$header") ;

  echo"<h1>Your message has been sent</h1>";


?>
This is the javascript to paste into the header section of your page it will not let the form be submitted without senders email address entered.

Code:
<script type="text/javascript">
function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
  }
}

function validate_form(thisform)
{
with (thisform)
  {
  if (validate_required(email,"Email must be filled out!")==false)
  {email.focus();return false;}
  }
}
</script>
I will remove this in 24 hours but I left it for you to see how it looks

http://www.bmcoll.com/testfolder/mailform.html

Send your self an email with it .
__________________
I hope to build a site with something for every body
www.bmcoll.com
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:55 AM.



mouseover mouseover mouseover