ok i have a form which gets filled in and then gets inserted to a database is it possable and how for it to send me an email saying that an entry has been made 2nd at the moment i have a browse button which reads off a database into a table i would like to have a picture with each entry i have read you cant store pics in database so what is the best way of doing this cheers Doug
#1 Try php.net and find mail() function. #2 Good way is writiting the path to pics in database and pic files in this path. Regards, M
tutankh is on for #1, mail($to, $subject, $message, 'From: '.$from); will do what you want it to. #2, technically you could store an image, but it's not recommended. I don't suggest writing the database in the path at all, that increases your database size and is a little redundant (plus I've done sites that end up changing it later so it's a hassle). Store ONLY the images file name, because if the path stays the same everytime, no need to tag it on there everytime.
ok thanks got the email ok can you point me to where i can find out more about the pics thing cheers Doug
Not sure what all you want to know. You pretty much upload it with a form, I think the proper thing to add to the form tag is enctype="multipart/form-data". Then <input type="file" name="whatever">, and in the PHP receiving file you get a $_FILES['whatever'] array. move_upload_file($_FILES['whatever']['tmp_name'], 'new/file/area/'.$_FILES['whatever']['name']); and insert $_FILES['whatever']['name'] into a database. It's a pretty simple process, although it's not a bad idea to rewrite the name of the file to prevent abuse.
well i am a bit confused as you said earier to put a link in database to pic so i made a folder called pics on server and have a jpeg in it what do i have to do to add the link in the database to pic sorry if a bit slow but new to this cheers Doug
You would need a database table to hold the images. In this case lets call it `images`, with `id` int(11) and `name` varchar(50). You'd want to do INSERT INTO `images` (`name`) VALUES('".$image_name."') Now you've stored the image name into the database, and you can run a query to retrieve it in the future, and it corresponds to the file you've saved in a folder.
Yeah. Filenames in DB is good way if You store all files in the same directory. I also store filenames in DB. Don't know why I wrote 'path'. Regards, M