Current location: Hot Scripts Forums » General Community » Script Requests » Looking for php mail form w/ attachments and required fields


Looking for php mail form w/ attachments and required fields

Reply
  #1 (permalink)  
Old 08-11-06, 04:14 AM
Sithlord999 Sithlord999 is offline
New Member
 
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Looking for php mail form w/ attachments and required fields

Hello.
I'm working on an email form on Dreamweaver and I'm looking for a PHP code to make it work. The form with some required fields would send the submitted information and two image attachments to my email address.
I just started looking at PHP two weeks ago for an answer and the only code that worked for me, so far, was a simple php email form:

<html>
<head></head>
<body>
<h2>Simple Mail Form</h2>
<?
if(isset($submit)) {
//check for email injection attack; refuse if injection
$attack = false;
foreach($_POST as $field => $input) {
$input = stripslashes($input);
if(preg_match('/Content-Type: multipart\/mixed/i', $input)) $attack = true;
if($field != 'comment') {
if(preg_match('/\n/', $input)) $attack = true;
if(preg_match('/\r/', $input)) $attack = true;
}
}
if(!$attack) {
// enter the email addy you want the message sent to:
$to = "email@domain.com";

mail($to, $subject, $comment, $name);
echo "<p>Thank you for your comment! We will respond shortly.</p>";
}
}
else {
?>
<form id="email" method="post">
<p>Name: <input type="text" id="name" name="name" size="30" maxlength="100" /></p>
<p>Subject: <input type="text" id="subject" name="subject" size="30" maxlength="100" /></p>
<p>Comment: <input type="textarea" id="comment" name="comment" cols="30" rows="10">
</p>
<p><input type="submit" name="submit" id="submit" value="Submit" /></p>
</form>
<?
}
?>

</body>
</html>


--------------------------------------------------------------------------------------------------------------------------------------------

However I am looking for a more advanced code for a form with some required fields that can send text and attachments. Any help is duly appreciated.

(here is a page I found earlier but I can't seem to make work)
http://66.102.7.104/search?q=cache:v...s&ct=clnk&cd=4

--------------------------------------------------------------------------------------------------------------------------------------------
here's the Dreamweaver html code for my form:
--------------------------------------------------------------------------------------------------------------------------------------------
<html>
<head>
<title>Submission Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="submission" method="post" action="" enctype="multipart/form-data">
<p align="center"><font size="6" face="Gill Sans MT"><b>Submission Form</b></font></p>
<table width="589" border="1" cellspacing="0" cellpadding="0" height="111" bgcolor="#999999" bordercolor="#FFFFFF">
<tr>
<td width="248" height="37">
<div align="center"><font face="Franklin Gothic Book"><font size="3" face="Gill Sans MT"><b>Your
Name </b></font><font face="Gill Sans MT"></font></font></div>
</td>
<td width="335" height="37">
<div align="center"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"></font></font><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font color="#FF0000" size="1">*</font></font></font></font></font><font size="3">
<input type="text" name="yourname" size="30">
</font></div>
</td>
</tr>
<tr>
<td width="248" height="37">
<div align="center"><font face="Franklin Gothic Book"><b><font face="Franklin Gothic Book"><b><font size="3" face="Gill Sans MT">Your
Email</font></b></font></b></font></div>
</td>
<td width="335" height="37">
<div align="center"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"></font></font><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"></font></font><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font color="#FF0000" size="1">*</font></font></font></font></font><font size="3">
</font><font size="3">
<input type="text" name="youremail" size="30" value="youremail@domain.com">
</font></div>
</td>
</tr>
<tr>
<td width="248" height="37">
<div align="center"><font face="Franklin Gothic Book"><b><font size="3" face="Gill Sans MT">Your
Site Name </font></b></font></div>
</td>
<td width="335" height="37">
<div align="center"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"></font></font><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"></font></font><font size="3">
</font><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font color="#FF0000" size="1">*</font></font></font></font></font><font size="3">
</font><font size="3">
<input type="text" name="yoursite" size="30">
</font></div>
</td>
</tr>
<tr>
<td width="248" height="37">
<div align="center"><font face="Franklin Gothic Book"><b><font size="3" face="Gill Sans MT">Your
URL</font></b></font></div>
</td>
<td width="335" height="35">
<div align="center"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"></font></font><font size="3">
</font><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font color="#FF0000" size="1">*</font></font></font></font></font><font size="3">
</font><font size="3">
<input type="text" name="yoururl" size="30" value="http://">
</font></div>
</td>
</tr>
<tr>
<td width="248" height="37">
<div align="center">
<p><font face="Franklin Gothic Book"><b><font face="Gill Sans MT">Your
Number</font></b></font></p>
</div>
</td>
<td width="335" height="37">
<div align="center"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font color="#FF0000" size="1">*</font></font></font></font></font><font size="3">
</font><font size="3">
<select name="yournumber">
<option selected>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
</select>
</font><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"></font></font></font></div>
</td>
</tr>
<tr>
<td width="248" height="37">
<div align="center"><font face="Franklin Gothic Book"><b><font size="3" face="Gill Sans MT">Coordinates</font></b></font></div>
</td>
<td width="335" height="37">
<div align="center"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font color="#FF0000" size="1">*</font></font></font></font></font><font size="3">
</font><font size="3">
<input type="text" name="coordinates" size="20" value=" i.e. A-1 or A.B-1 or A-1.2">
</font><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"></font></font></div>
</td>
</tr>
<tr>
<td width="248" height="37">
<div align="center"><font face="Franklin Gothic Book"><b><font size="3" face="Gill Sans MT">Your
Image</font><font size="3"><font size="1"><br>
</font></font></b><font size="3"><font size="1" face="Verdana">gif -
png - jpg / jpeg files </font></font></font></div>
</td>
<td width="335" height="37">
<div align="center"><font size="3">
<input type="file" name="image1" size="30" value="">
<font face="Franklin Gothic Book" size="1" color="#999999"> </font></font></div>
</td>
</tr>
<tr>
<td width="248" height="37">
<div align="center"><font face="Franklin Gothic Book"><b><font size="3" face="Gill Sans MT">Your
Snapshot</font><font size="3"><font size="1"><br>
</font></font></b><font size="3"><font size="1"><font face="Franklin Gothic Book"><font size="3"><font size="1" face="Verdana">jpg
/ jpeg files </font></font></font></font></font></font></div>
</td>
<td width="335" height="37">
<div align="center"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"></font></font><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font color="#FF0000" size="1">*</font></font></font></font></font><font size="3">
</font><font size="3">
<input type="file" name="file2" size="30" value="">
</font></div>
</td>
</tr>
<tr>
<td width="248" height="37">
<div align="center"><font face="Gill Sans MT"><b>pop-up message description</b></font></div>
</td>
<td width="335" height="37">
<div align="center"><font size="3">
<input type="text" name="popupmessage" size="40" value="Site description -- 60 characters max." maxlength="60">
</font></div>
</td>
</tr>
<tr>
<td width="248" height="37">
<div align="center"><font face="Gill Sans MT"><b>pop-up message<font size="3">
color BG</font></b></font></div>
</td>
<td width="335" height="37">
<div align="center"><font size="3">
<select name="popupcolors">
<option selected>yellow hue</option>
<option>blue hue</option>
<option>red hue</option>
<option>green hue</option>
<option>orange hue</option>
<option>pink tint</option>
<option>purple hue</option>
<option>brown hue</option>
<option>beige tint</option>
<option>gray shade</option>
<option>plain white</option>
</select>
</font></div>
</td>
</tr>
</table>
<hr>
<div align="left">
<p>
<input type="checkbox" value="checkbox" name="checkthisbox">
Check this box.<font color="#FF0000" size="2">*</font></p>
<p align="center">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="clear" value="Reset">
</p>
<p><font face="Franklin Gothic Book"><font face="Franklin Gothic Book"><font color="#FF0000" size="1">*</font></font></font>
<font size="1" face="Trebuchet MS">required fields</font></p>
</div>
<div align="center">
<hr>
<p>&nbsp; </p>
</div>
</form>
<p>&nbsp; </p>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------------

Thank you in advance.
SL999.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Formmail Script Fix - Cant display multiple list selections.. zamen PHP 3 05-02-04 09:59 AM


All times are GMT -5. The time now is 11:27 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.