Simple feedback form gives me error messages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Subyne Simean
Forum Newbie
Posts: 19
Joined: Tue May 09, 2006 1:59 pm

Simple feedback form gives me error messages

Post 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!
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Are you trying to run this script on your local server?
Subyne Simean
Forum Newbie
Posts: 19
Joined: Tue May 09, 2006 1:59 pm

Post by Subyne Simean »

yes, from my hard drive
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Do you have your SMTP server set up on your local machine?
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post 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.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Oh... ok 8)
Subyne Simean
Forum Newbie
Posts: 19
Joined: Tue May 09, 2006 1:59 pm

Post by Subyne Simean »

Those instructions never said anything about a SMTP server! I'll take a look...
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post 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.
Subyne Simean
Forum Newbie
Posts: 19
Joined: Tue May 09, 2006 1:59 pm

Post 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!
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
Subyne Simean
Forum Newbie
Posts: 19
Joined: Tue May 09, 2006 1:59 pm

Post 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?
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post 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.
Subyne Simean
Forum Newbie
Posts: 19
Joined: Tue May 09, 2006 1:59 pm

Post 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 :)
Subyne Simean
Forum Newbie
Posts: 19
Joined: Tue May 09, 2006 1:59 pm

Post 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?
Post Reply