<?php
/*
Template Name: send-photo

*/
mysql_connect(‘localhost’,’root’,”);
mysql_select_db(‘test’);
//$title=$_POST[‘title’];

if(isset($_POST[‘sendphoto_submit’]))
{
$state = $_POST[‘sendphoto_locationId_state’];
$facility = $_POST[‘sendphoto_locationId’];
$photofor = $_POST[‘sendphoto_recipient’];
$entermessage  =  $_POST[‘sendphoto_message’];
$image=$_FILES[‘sendphoto_photo’][‘name’];
$upload_path=”photos/”;
move_uploaded_file($_FILES[‘sendphoto_photo’][‘tmp_name’],”$upload_path”.”$image”);
$query=”INSERT INTO wp_sendphoto(state,facility,photofor,entermessage,image) VALUES (‘$state’,’$facility’,’$photofor’,’$entermessage’,’$image’)”;
$result=mysql_query($query);
if($result)
{
echo “<script language=\”javascript\”>\n”;

echo “alert(‘Thanks for your interest.Sending Your photo .’)\n”;

echo ‘ header(“location:sendphotos”) ‘;

echo “</script>”;
}
else
{
echo “Cannot send photo .”;
}
}
//header(“location:sendphotos”);
?>