Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Form Submission/Mail To Script

Links for php scripts

Moderators: macek, egami, gesf

Form Submission/Mail To Script

Postby xiaoaiz1865 » Thu Nov 25, 2004 12:17 pm

Here it is.
form.php

Code: Select all
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form action="mailit.php" method="post" name="frmEmail" id="frmEmail">
  Name:
  <input name="name" type="text" id="name">
  <br>
  E-mail:
  <input name="email" type="text" id="email">
  <br>
  Message:<br>
  <textarea name="message" id="message"></textarea>
  <br>
  <input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>


mailit.php

Code: Select all
<?php
sMessage = "Message from: " + $_GET['name'] +"<BR>";
sMessage .= "Email: <a href='mailto:" + $_GET['email'] + "'>" + $_GET['email'] + "</a>";
sMessage .= "Message was:" + $_GET['message'];
mail "mail@mail.com", "Contact Mail...", sMessage;
?>


Change mail@mail.com to your email address.
xiaoaiz1865
New php-forum User
New php-forum User
 
Posts: 8
Joined: Thu Nov 25, 2004 11:52 am

Postby Alex » Mon Nov 29, 2004 9:26 am

I dont want to upset you in any way, but there is room for improvement. For example, you could check the validity of the email adress (in part) via reg exp and allow for attatchments (i beleive i wrote a class for that a while back, but there is lots of documentation and examples out there). Its a good idea to put a from field in there too...
Alex
New php-forum User
New php-forum User
 
Posts: 180
Joined: Fri Mar 07, 2003 4:59 pm


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron