Hi there,
I am new to PHP, and this forum. I have attempted to create my first very basic PHP script, simply to mail a form, however when i try to run it, all i get is a blank page with no email.
My server (freehostia chocolate account) says it supports PHP.
The files are at: http://www.waynecovell.co.uk/form.html
and: http://www.waynecovell.co.uk/sendmail.php
Anyone shed light into a noobs world of PHP?
Thanks in advance
New to PHP, code is not working
Moderator: General Moderators
Re: New to PHP, code is not working
Welcome 
Blank page is a parse error. You'll want to enable error reporting.
Put this at the top of your code:
Blank page is a parse error. You'll want to enable error reporting.
Put this at the top of your code:
Code: Select all
error_reporting(E_ALL);
ini_set('display_errors', true);Re: New to PHP, code is not working
Ah thanks for that. Now I get the error
EDIT: Okay, so I did remove those. and it worked. now i get these errors:
And i simply do not understand why the others are undefined?
I read a tutorial that, remove_headers() is what you should do for mailing a form. As this is causing the error, should I try just removing the remove_headers from the code?Fatal error: Call to undefined function remove_headers() in /home/www/waynecovell.co.uk/sendmail.php on line 13
EDIT: Okay, so I did remove those. and it worked. now i get these errors:
I understand the last one means i can only email 5 parameters, but how do people get around this?Notice: Undefined index: Option1 in /home/www/waynecovell.co.uk/sendmail.php on line 21
Notice: Undefined index: Option2 in /home/www/waynecovell.co.uk/sendmail.php on line 22
Warning: mail() expects at most 5 parameters, 14 given in /home/www/waynecovell.co.uk/sendmail.php on line 30
And i simply do not understand why the others are undefined?
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: New to PHP, code is not working
No this means that the mail() function expects only 5 parameters (arguments). This is from the PHP Manual:wayneio wrote:I understand the last one means i can only email 5 parameters, but how do people get around this?
You can get around it (send mail to multiple users) by using loops or arrays. Please post your scriptbool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
Hth
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering