|
|||||||
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!
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
|
|
|||
|
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
|
|
||||
|
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> 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>";
?>
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>
http://www.bmcoll.com/testfolder/mailform.html Send your self an email with it . |
![]() |
| Thread Tools | |
| Display Modes | |
|
|