First of all let me say thank you to all of you who have helped me so far with previous posts, You've already increased my knowledge tenfold.
Anyway what i'd like to do now is allow a user to upload an image to a web server, this image will then be emailed to a recipient.
What confuses me is how i actually grab the required filename and pass it to a template i created which should then be displayed in an email. So far using str_replace i can hard code a file path of a picture which gets sent in an email,
$targets = array("<!--EMAIL-->", "<!--GREETINGS-->", "<!--NAME-->", "<!--IMG1-->", "<!--IMG2-->", "<!--Img1Text-->", "<!--Img2Text-->", "<!--MESSAGE-->", "<!--SALUTATION-->",);
$replace = array($row['email'], ($_POST[greetings]), $row['name'],"<img src = 'http://www.mysite.co.uk/files/image.jpg" ,"http://www.mysite.co.uk/files/" ,($_POST[Img1Text]), ($_POST[Img2Text]),($_POST[message]), ($_POST[salutation]),);
$msg[$i] = str_replace($targets, $replace, $message);
but i have no idea how to allow the user to change that picture.
I'm thinking that i need to change
$replace = array($row['email'], ($_POST[greetings]), $row['name'],"<img src = 'http://www.mysite.co.uk/files/image.jpg" ,"http://www.mysite.co.uk/files/" ,($_POST[Img1Text]), ($_POST[Img2Text]),($_POST[message]), ($_POST[salutation]),);
to
$replace = array($row['email'], ($_POST[greetings]), $row['name'],"<img src = '$site_dir/$user_image" ,"$site_dir/$user_image2" ,($_POST[Img1Text]), ($_POST[Img2Text]),($_POST[message]), ($_POST[salutation]),);
and defining the variables $site_dir, $user_image, $user_image2 as global somewhere but allowing them to be redefined in a file explorer script or something.
soooo... I'm guessing I need a way of letting the user view the files that have been uploaded and make a selection. Am i right in saying that the selected file will need pass its id value to the sql table in order to return the file path that is stored?
if this is the case am i also right in saying that i will need to create some sort of browser? I've been thinking about it alot and i dont quite know how i'm going to pass the required images filename into the form which replaces a string in a template and sends the mail.
Make any sense to anyone?
Any advice or helpful links would help alot.
chinrub