babiesonthego
New Member
Hi everyone!
I need to have a web page that allows visitors to email me their favorite photo and I am using basic html and PHP. However, I am doing something wrong, because I receive the visitor's information but not the image.
PLEASE HELP!
Here is the page's html:
<form method="post" action="photos.php" enctype="multipart/form-data">
<table cellspacing=0 cellpadding=5 width="95%" border=1 bordercolor="#3399FF">
<tbody>
<tr>
<td width="40%" class="blackp"><strong>Name of mum-to-be:</strong> </td>
<td width="60%"><div align="left" class="blackp">
<input type="text" maxlength=35 size=45 name="name" />
</div></td>
</tr>
<tr>
<td class="blackp" width="40%"><strong>Email address:</strong> </td>
<td width="60%"><div align="left" class="blackp">
<input type="text" maxlength=35 size=45 name="email" />
</div></td>
</tr>
<tr>
<td class="blackp" width="40%"><strong>Phone number:</strong> </td>
<td width="60%"><div align="left" class="blackp">
<input type="text" maxlength=15 size=45 name="phone" />
</div></td>
</tr>
<tr>
<td class="blackp" width="40%"><input type="hidden" name="max_file_size" value="1000000" />
<strong>Photo to be uploaded:</strong> </td>
<td width="60%"><div align="left" class="blackp">
<input type="file" name="uploadfile" size="45" />
</div></td>
</tr>
<tr>
<td class="blackp" width="40%"><strong>Photo captions:</strong> </td>
<td width="60%"><div align="left" class="blackp">
<input type="text" maxlength=70 size=45 name="captions" />
</div></td>
</tr>
<tr>
<td width="40%" height=19 class="blackp">Click button to <strong>send
your email</strong>.</td>
<td width="60%" class="blackp"><input name="contactus" type = "submit" class="blackp" value="send" /></td>
</tr>
</tbody>
</table>
</form>
And here is the PHP coding:
<?
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$phone = $_REQUEST['phone'] ;
$uploadfile = $_REQUEST['uploadfile'] ;
$explanation = $_REQUEST['explanation'] ;
$captions = $_REQUEST['captions'] ;
if (!isset($_REQUEST['email'])) {
header( "Location: http://www.britishbabyshower.co.uk/photos.html" );
}
elseif (empty($name) || empty($email)) {
header( "Location: http://www.britishbabyshower.co.uk/error.html" );
}
else {
mail( "[email protected]", "Contact Us Form",
"Name: $name\nPhone Number: $phone\nEmail Address: $email\nImage Uploaded: $uploadfile\nCaptions: $captions",
"From: $name <$email>" );
header( "Location: http://www.britishbabyshower.co.uk/thankyou.html" );
}
?>
I need to have a web page that allows visitors to email me their favorite photo and I am using basic html and PHP. However, I am doing something wrong, because I receive the visitor's information but not the image.
PLEASE HELP!
Here is the page's html:
<form method="post" action="photos.php" enctype="multipart/form-data">
<table cellspacing=0 cellpadding=5 width="95%" border=1 bordercolor="#3399FF">
<tbody>
<tr>
<td width="40%" class="blackp"><strong>Name of mum-to-be:</strong> </td>
<td width="60%"><div align="left" class="blackp">
<input type="text" maxlength=35 size=45 name="name" />
</div></td>
</tr>
<tr>
<td class="blackp" width="40%"><strong>Email address:</strong> </td>
<td width="60%"><div align="left" class="blackp">
<input type="text" maxlength=35 size=45 name="email" />
</div></td>
</tr>
<tr>
<td class="blackp" width="40%"><strong>Phone number:</strong> </td>
<td width="60%"><div align="left" class="blackp">
<input type="text" maxlength=15 size=45 name="phone" />
</div></td>
</tr>
<tr>
<td class="blackp" width="40%"><input type="hidden" name="max_file_size" value="1000000" />
<strong>Photo to be uploaded:</strong> </td>
<td width="60%"><div align="left" class="blackp">
<input type="file" name="uploadfile" size="45" />
</div></td>
</tr>
<tr>
<td class="blackp" width="40%"><strong>Photo captions:</strong> </td>
<td width="60%"><div align="left" class="blackp">
<input type="text" maxlength=70 size=45 name="captions" />
</div></td>
</tr>
<tr>
<td width="40%" height=19 class="blackp">Click button to <strong>send
your email</strong>.</td>
<td width="60%" class="blackp"><input name="contactus" type = "submit" class="blackp" value="send" /></td>
</tr>
</tbody>
</table>
</form>
And here is the PHP coding:
<?
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$phone = $_REQUEST['phone'] ;
$uploadfile = $_REQUEST['uploadfile'] ;
$explanation = $_REQUEST['explanation'] ;
$captions = $_REQUEST['captions'] ;
if (!isset($_REQUEST['email'])) {
header( "Location: http://www.britishbabyshower.co.uk/photos.html" );
}
elseif (empty($name) || empty($email)) {
header( "Location: http://www.britishbabyshower.co.uk/error.html" );
}
else {
mail( "[email protected]", "Contact Us Form",
"Name: $name\nPhone Number: $phone\nEmail Address: $email\nImage Uploaded: $uploadfile\nCaptions: $captions",
"From: $name <$email>" );
header( "Location: http://www.britishbabyshower.co.uk/thankyou.html" );
}
?>