Log in

View Full Version : New to PHP. Need help with email script



rockinrick
08-13-2007, 05:29 PM
Hello!
I'm new to this forum and PHP. I'm trying to figure out the code needed for sending a form to a website's email address. I'm assuming I need PHP, as in the ftp directory is has a folder for PHP uploads. Can someone point me in the right direction?

Many thanks,
RockinRick

boogyman
08-13-2007, 06:04 PM
to send an email you need to have a php capable host, than u create your form and use the mail() function to actually send the email.



$to = "email @ domain.extension";
$subject = "whatever you want the subject of the email";
$message = "contents of the message (gather from your form)";

mail($to, $subject, $message);


I would however suggest that you use some sanitizing techniques, like trim() (deletes before/after extra spaces) and strip_tags() (deletes and code tags)
there are numerous tutorials on how to make your form as generic as possible, use google to search for those, there also might be a thread here, but if you have any specific questions about how to do something there are plenty of people here that would be willing to help

rockinrick
08-13-2007, 08:47 PM
Thanks Boogyman for the reply!
Yes the site I'm working on does handle PHP email. I've Googled beginner PHP and I'm just a little overwhelmed! I'm trying to recreate the form on this page: http://www.eastbayvet.com/site/view/47973_RxRefill.pml;jsessionid=chb9crta95i

It's for people refilling their pets medication online. I know I need a PHP Hypertext Document, but I'm still lost. Any further direction would be appreceated!

Thanks again,
RockinRick

boogyman
08-13-2007, 08:56 PM
what are you talking about hypertext?

are you talking about the stuff that the user sees?
or are you talking about the processing and sending of the information?

if you are talking about the first, that is something you need to create yourself, the latter is most likely in the tutorials you obtained

rockinrick
08-13-2007, 09:09 PM
Sorry if I'm confused with terminology. A few years ago I installed a flash php email form and had bto use a mail script. I guess that's not the case here.

I'm just trying to find out what I need to set up a form that can be emailed to the Vet.

Thanks again,
Rick