PDA

View Full Version : PHP newbie Question


bgalvan
1-10-02, 10:20 AM
OK, folks, I'm new at this so bear with me.
I design webpages using flash and have just started getting into the world of backend programming. I have come across websites that have an email form on the site that emails directly to the specified email address.(all within the web browser)
I have found the script and have adjusted the .php script and have the email form on my website.
According to the instructions that I have it says the script has to be in the same directory as the web page.
I did this but the form never procecess the email form.

As far as I know PHP is installed in my web hosting plan.

Do I have to do anything special to get this script to work?

Any comment are greatly appreciated. Thanks

bgalvan
1-10-02, 09:13 PM
Ok so after a little RTFM, I have noticed that I need to put this at the top of my .php scripts
#!/usr/local/bin/php

So I inserted that at the top of my script. Then I proceeded and uploaded into htdocs directory along with the flash movie that will be calling it up.

the script looks like this:
#!/usr/local/bin/php
<?
$ToEmail = "bgalvan@churchstny.com";

##$ToName = "Brian";
$ToSubject = "Example Mail from SendMail Tutorial";

$EmailBody = "Sent By: $FirstName\nSenders Email: $Email\nSenders Company: $Company\n\nMessage Sent:\n$ToComments\n\nSender Heard About Site From: $HearAbout\n";

$EmailFooter="\nThis message was sent by: $FirstName from $REMOTE_ADDR If you feel that you recieved this e-mail by accident please contact us at www.briangalvan.com";

$Message = $EmailBody.$EmailFooter;

mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$FirstName." <".$Email.">");

Print "_root.Mail.EmailStatus=Complete - Your mail has been sent";

?>


I uploaded it as an ASCII file and chmod to 755 like it says to do.

The php file resides with my flash movie inside htdocs directory(this is correct right?)

I don't know what else to do, am I missing anything?

bgalvan
1-10-02, 09:37 PM
when I check the server I'm on it shows the path to php.ini as being this:
/usr/local/lib/php.ini


Should this go on top of my php files, or should I continue to put #!/usr/local/bin/php.ini at the top of my php files?

UnnDunn
1-13-02, 05:41 AM
Originally posted by bgalvan
when I check the server I'm on it shows the path to php.ini as being this:
/usr/local/lib/php.ini


Should this go on top of my php files, or should I continue to put #!/usr/local/bin/php.ini at the top of my php files? No. You are not looking for the path to "php.ini"... you just want "php".

You say "it never processes the email form". Can you be more specific? What happens? Do you get a 500 error? A PHP parsing error (I noticed a couple in the code fragment you posted)? Or does nothing happen at all?

bgalvan
1-13-02, 10:50 PM
Nothing ever happens

The actionscript in the Flash Button looks like this:

on (release) {
if (!Email.length || Email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
EmailStatus = "Please enter a valid E-mail address";
} else if (!ToEmail.length || ToEmail.indexOf("@") == -1 || ToEmail.indexOf(".") == -1) {
EmailStatus = "Please enter a valid E-mail address that you are sending this to";
} else if (!ToName.length) {
EmailStatus = "Please Enter the name of who you are sending this to";
} else if (!FirstName.length) {
EmailStatus = "Please Enter your name before Sending";
} else if (!ToComments.length) {
EmailStatus = "Please enter some text in you message";
} else {
loadVariablesNum ("snowMailPHP.php", "0", "POST");
EmailStatus = "Sending... one Moment .. or two.. sometimes it's faster then other times";
}
}


All that is displayed on the website is that last line(Sending...one Moment..or two..sometimes it's faster then other times";)

But it just stays there.
I have inserted #!/usr/local/lib/php at the top of the php script.
Uploaded it as an ASCII and chmod directory to 755

P.S. thanks for your help