form mailer not working

I recently upgraded my server to php 5.3. The contact form now will mail the subject line, and the subject titles in the message but the information itself does not come through. It also refreshes the page to the thank you screen. I am not a backend coder so I am lost in the search for the issue in the coding. For now I simply put the php file in a directory of a clients since they are on a different server and directed the return lines back to my website. It works perfect on their server which I am sure is an older version of php. [php]<?php

/* Subject and Email Variables */

$emailSubject = 'my name';
$webMaster = '[email protected]';

/* Gathering Data Variables */

	$nameField = $_POST['name'];
	$emailField = $_POST['email'];
	$phoneField = $_POST['phone'];
	$interestField = $_POST['interest'];
	$commentField = $_POST['comment'];

	
	$body = <<<EOD





Name: $name

Email: $email

Phone: $phone

Interest: $interest

Comments: $comment

EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);[/php]

This is the top part of the code where i feel the issue is. Would love some help. THanks

Get rid of that EOD crap, change it to
[php]
$body = “

Name: $name
Email: $email
Phone: $phone
Interest: $interest
Comments: $comment”;[/php]

That is not the section that the issue rises from. That part goes through the email. The only thing that dont work is the actually information or content of the message. I changed it to what you wrote and it did the same thing. That code works just as well as the code i replaced.

You should be able to see what’s wrong.

This
$nameField = $_POST[‘name’];
$emailField = $_POST[‘email’];
$phoneField = $_POST[‘phone’];
$interestField = $_POST[‘interest’];
$commentField = $_POST[‘comment’];

has to match
Name: $name

Email: $email

Phone: $phone

Interest: $interest

Comments:$comment

Do you see why the body stuff isn’t showing up?

I must be retarded here. I mean obviously $nameField and $name are different. So are you saying they both have to say $nameField or $name or did I miss the boat. I give people like you credit for understanding this stuff that is for sure.

Also when my server was running php 4 it all worked perfect with that coding.

Well, then i don’t know. Witih what you have posted, i would have to say they have to match.

Ok I changed the bottom coding to match the top by adding Field to them and they work perfect now. Dude you rock thank you for your help.

I can only assune that was some wort of validation going on, and the body variables may have been coming from there. Glad its working though.

Yeah not sure. The only code left that wasnt on the above is the html it redirects and reloads for a thank you page. Either way it worked so for the night you are awesome.

This most likely worked in PHP 4 because register_globals was enabled by default. It has since been changed and I believe should never be turned on.

http://php.net/manual/en/security.globals.php

I will be honest this stuff just makes no sense to me. I tried to learn this code but I am a graphic artist that just so happens to be able to code up the front end side of a website ex:html, html5, css, css3. I am just glad the smart people out there are around to help when we need em.

Sponsor our Newsletter | Privacy Policy | Terms of Service