I'm trying to piece together an email order form. This form has a few different aspects to it. I am getting an error on my for proces, conf_order.php.
Here is my form on order.php I dont think there are any issues on this page..
<form method="post" action="conf_order.php">
<?php
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
Your Name: <br />
<input type="text" name="visitor" size="45" />
<br />
Your Email:<br />
<input type="text" name="visitormail" size="45" />
<br />
Submit a photo:(accepted image types:.jpeg, .png, .gif; 2MB max)<br/>
<input type="file" name="visitorimage" size="45"/>
<br/>
Additional information:
<br />
<textarea name="notes" rows="4" cols="70"></textarea>
<br />
Include Shirt: <br/>
No:<input type="radio" name="shirt" onclick="jfunc(this.value)" value="shirt_no"/>
Yes:<input type="radio" name="shirt" onclick="jfunc(this.value)" value="shirt_yes"/>
<br/>
<div id="jdiv" style="display:none;">
Size:
<select name="size" id="size" onChange="MM_jumpMenu('parent',this,0)">
<option>medium</option>
<option>large</option>
<option>XL</option>
<option>XXL</option>
</select>
<br/>
</div>
<input type="submit" value="Submit order" />
<br />
</form>
Now my conf_order.php is still a work in progress but I am trying to get whats on there now to work, then I will add the rest once that is finished.
My error is with the image type, it is telling me that its an invalid image type
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];
$visitorimage = $_FILE['visitorimage'];
$shirtYes = $_POST['shirt_yes'];
$shirtNo = $_POST['shirt_no'];
$size = $_POST['size'];
//image checker
if ((($visitorimage["type"] == "image/gif")
|| ($visitorimage["type"] == "image/jpeg")
|| ($visitorimage["type"] == "image/jpg")
|| ($visitorimage["type"] == "image/pjpeg")
|| ($visitorimage["type"] == "image/png"))
&& ($visitorimage["size"] < 2097152))
{
if ($visitorimage["error"] > 0)
{
echo "Return Code: " . $visitorimage["error"] . "<br />";
}
else
{
echo "Upload: " . $visitorimage["name"] . "<br />";
echo "Type: " . $visitorimage["type"] . "<br />";
echo "Size: " . ($visitorimage["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $visitorimage["file"]["tmp_name"] . "<br />";
if (file_exists("upload/" . $visitorimage["name"]))
{
echo $visitorimage["name"] . " already exists. ";
}
else
{
move_uploaded_file($visitorimage["tmp_name"],
"upload/" . $visitorimage["name"]);
echo "Stored in: " . "upload/" . $visitorimage["name"];
}
}
}
else
{
echo "Invalid image type. Please Try again";
}
//check for shirt
//check for valid information
if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}
//checks for all fields
if(empty($visitor) || empty($visitormail) || empty($notes ) || empty($visitorimage)) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}
$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = $attn;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
adition information: $notes \n
From: $visitor ($visitormail)\n
image name: $visitorimage \n
shirt: \n
shirt size: $size \n
tech info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";
$from = "From: $visitormail\r\n";
mail("", $subject, $message, $from);
?>
<p align="left">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />
Addition information:<br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<br /><br />
<a href="index.php"> Submit Comment and Return Home </a>
</p>
</div>
Sorry the commenting is not very good on here..