Skip to content
Advertisement

Submit button is downloading the php instead of running it

I’m trying to make a contact form for my website but when I press submit, the php file is downloaded instead of being ran. I am using chrome but don’t think that should matter I think there’s a syntax error but I’ve messed around with removing, adding and stuff and even when there is no syntax errors, it still downloads the file rather than runs it And, yes…it is the exact name of the php file (SendEmail.php)

HTML

JavaScript

PHP

JavaScript

I can’t find what’s wrong!!!

Advertisement

Answer

If the actual php soure code is being downloaded, you have some configuration issues on your webserver, but I won’t go into that here.

I do suggest you remove the @ infront of the mail command though, since that surpresses errors you might be having.

One of the errors ie. you are surpressing is the fact that yo u dont’ have a $Message variable, considering the fact that your code says: $email_from = $_POST['Message']; // required.

Aside from that: I suggest you read up about naming conventions concerning upper/lower case characters. It makes debugging code quite a bit easier. Try http://framework.zend.com/manual/1.12/en/coding-standard.naming-conventions.html for starters.

PS. You do actually have a $Message variable, but its empty.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement