thanks for the advice. this works in case anyone is interested:
<?php
require_once ('mysql_connect.php');
if ($HTTP_POST_VARS['submit']) {
$pic_name=$HTTP_POST_VARS['pic_name'];
$pic_person=$HTTP_POST_VARS['pic_person'];
$query ="INSERT INTO table (pic_name,pic_person)";
$query.=" VALUES ('{$_FILES['imagefile']['name']}','$pic_person')";
$result=mysql_query($query);
if ($result) echo "new image added!";
else echo "ERROR: unable to post.";
if (($_FILES['imagefile']['type'] == "image/gif") OR ($_FILES['imagefile']['type'] == "image/jpeg") OR ($_FILES['imagefile']['type'] == "image/pjpeg"))
{
copy ($_FILES['imagefile']['tmp_name'], "images/".$_FILES['imagefile']['name']) or die ("Could not copy");
}
else
{
echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")n";
}
if ($pic_person == 0) {
$to = "personb@whatever.com";
$subject = "persona has added a new image";
$message = "$realmessage";
mail($to,$subject,$message);
} else {
$to = "persona@whatever.com";
$subject = "personb has added a new image";
$message = "$realmessage";
mail($to,$subject,$message);
}
}
?>
and the form...
<form method="POST" action="upload_image.php" enctype="multipart/form-data">
<input type="file" name="imagefile" />
<br />
message for the email<br />
<textarea name="realmessage" cols="21" rows="10">
</textarea>
<br />
<input type="radio" name="pic_person" value="0">persona tick here<br />
<input type="radio" name="pic_person" value="1">personb tick here<br /><br />
<input type="submit" name="submit" value="upload image" />
</form>