I’m a fairly new PHP programmer, and I’m learning as I go.
I wrote a script for a client who is an attorney. Since there are multiple attorneys in the firm, I had to provide a way to differentiate who to send form data to.
The script currently seems to run (with warnings) (excuse the look of the site; I didn’t upload the css or images since I only wanted to test the php) but no form data is ever mailed out.
Also, I can’t get the splitter function to work correctly. the script is supposed to use the mail() function and I have the e-mail addresses pointed towards my addresses now for the purpose of testing, but neither address receives an email from the script. Also, regardless of which recipient option I choose, the php output specifies the mail was sent to homer harris (the first option).
Here’s the PHP code: (I’ve replaced the real email addresses with placeholders for privacy reasons)
[code]
<?php /* Tricked Out Email Splitter and sender ##################################### Written by Will Kraft Pagewizard Web Design ###################################### June 4, 2007 Feel free to redistribute and modify this PHP code under the terms of the GPL. */ // this is where the email subject is defined: $subject = "$sendto, there is a new message from the website!"; //define our variables $Name = $_POST[?Name?]; $Address = $_POST[?Address?]; $City = $_POST[?City?]; $Phone = $_POST[?Phone?]; $mailfrom = $_POST[?mailfrom?]; $sendto = $_POST[?sendto?]; //figure out where the mail is supposed to go if ($sendto = "homer") { // ...and send it!!! mail("EMAIL ADDRESS 1", $subject, $Name, $Address, $City, $Phone, $mailfrom); print 'The mail was delivered to Homer Harris.
'; } else if ($sendto = "alfonso") { // If the alfonso button is checked, the mail gets sent here. mail("EMAIL ADDRESS 2", $subject, $Name, $Address, $City, $Phone, $mailfrom); print 'The mail was delivered to Alfonso Oliva.
'; } echo 'Mail delivered successfully.'; ?>[/code][/url]