Page 1 of 1

Simple feedback form gives me error messages

Posted: Tue May 09, 2006 3:00 pm
by Subyne Simean
Hi, quite new to PHP so I apologise if this could have been sorted out somewhere else.

PHP Version: 5.1.2
Display Errors: On
Error Level: Not E_ALL
Register Globals: Off

I tried to make a simple feedback form with these instructions: http://www.thesitewizard.com/archive/feedbackphp.shtml

I made a form.php file for the form, the sendmail.php file as per the instructions and a thankyou.html file which all go into my www folder (running all of this locally).

When I submit the form, I'm expecting it to send me an email and take the visitor to a thankyou page. This is what I get instead:
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\php\PortableWebAp3.2\Program\www\localhost\sendmail.php on line 6

Warning: Cannot modify header information - headers already sent by (output started at C:\php\PortableWebAp3.2\Program\www\localhost\sendmail.php:6) in C:\php\PortableWebAp3.2\Program\www\localhost\sendmail.php on line 7
The problem may well be down to the fact that it says "Error Level: Not E_ALL" in the above info, as I saw on a thread here that it needs to just be "Error Level: E_ALL".

Firstly I tried changing this: error_reporting = E_ALL & ~E_NOTICE

To this: error_reporting = E_ALL

in the php.ini file, but I got the same errors and the phpinfo still says that error reporting is "Not E_ALL".

please help!

Posted: Tue May 09, 2006 3:34 pm
by Oren
Are you trying to run this script on your local server?

Posted: Tue May 09, 2006 8:53 pm
by Subyne Simean
yes, from my hard drive

Posted: Wed May 10, 2006 12:45 am
by RobertGonzalez
Do you have your SMTP server set up on your local machine?

Posted: Wed May 10, 2006 8:44 am
by Oren
Everah wrote:Do you have your SMTP server set up on your local machine?
Nah... he doesn't have, I can bet on that.

Try running the script on your host's server if you have one.

Posted: Wed May 10, 2006 10:04 am
by RobertGonzalez
I figured he doesn't. I am hoping to push him in the direction of looking at what he is doing from the beginning of the process.

Posted: Wed May 10, 2006 10:24 am
by Oren
Oh... ok 8)

Posted: Wed May 10, 2006 10:44 am
by Subyne Simean
Those instructions never said anything about a SMTP server! I'll take a look...

Posted: Wed May 10, 2006 1:01 pm
by Maugrim_The_Reaper
Warnings are not notices... You'd need to disable them as well as notices. But yes, an smtp server would help ;) The tutorial should have mentioned it.

Posted: Wed May 10, 2006 4:51 pm
by Subyne Simean
This is annoying now. Nothing I change in the PHP file sticks.

I changed those settings to this:
[mail function]
; For Win32 only.
SMTP = smtp.ntlworld.com
smtp_port = 25

; For Win32 only.
;sendmail_from = noreply@anon.com
...and I still get the above error telling me that it can't connect to mail server "local host".

Should the semi colon be there? I know that it's used to comment things out.

Please help before I cry!

Posted: Wed May 10, 2006 5:10 pm
by RobertGonzalez
I think there is more to it than setting a port number in your php.ini file. I think you actually need to configure your SMTP server on your computer. I have no idea how to do that but I bet google does.

Posted: Wed May 10, 2006 5:40 pm
by Subyne Simean
If I was running this script on a PHP enabled web host, would I need to do anything other than set the smtp server and port?

Posted: Wed May 10, 2006 5:59 pm
by Oren
Subyne Simean wrote:If I was running this script on a PHP enabled web host, would I need to do anything other than set the smtp server and port?
99.9% your script will work just as it is right now, you won't need to do anything but uploading the script to the server and run it.

Posted: Wed May 10, 2006 6:27 pm
by Subyne Simean
I'll see if my NTL webspace is PHP enabled, otherwise I'll test it on tripod.co.uk

I'll let you know. thanks :)

Posted: Thu May 18, 2006 10:48 pm
by Subyne Simean
http://www.smartrecruituk.com/form.php doesn't actually send an email to my email address.

Does anyone know of a PHP/SMTP enabled free web host?

I signed up for one but never got their confirmation email... maybe it was a hoax site.

The server above has a cgi folder... maybe I have to learn that instead?