PHP Mail problem

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
JeffK
Forum Newbie
Posts: 3
Joined: Tue May 11, 2010 8:42 am

PHP Mail problem

Post by JeffK »

Hello there,

I'm new to this forum, but I need some help and you guys seem to know a lot about PHP, so here it goes.

I'm creating a form and the results need to be send by email to me. Here's the code:

Code: Select all

<?php

	$EmailSubject = 'Email Subject';
	$EmailTo = 'emailhere@email.com';
	
	$InputBreedte_1 = $_POST['InputBreedte_1'];
	$InputBreedte_2 = $_POST['InputBreedte_2'];
	$InputBreedte_3 = $_POST['InputBreedte_3'];
	$InputBreedte_4 = $_POST['InputBreedte_4'];
	$InputBreedte_5 = $_POST['InputBreedte_5'];
	$InputBreedte_6 = $_POST['InputBreedte_6'];
	$InputBreedte_7 = $_POST['InputBreedte_7'];
	$InputBreedte_8 = $_POST['InputBreedte_8'];
	$InputBreedte_9 = $_POST['InputBreedte_9'];
	$InputBreedte_10 = $_POST['InputBreedte_10'];
	$InputBreedte_11 = $_POST['InputBreedte_11'];
	$InputBreedte_12 = $_POST['InputBreedte_12'];
	$InputBreedte_13 = $_POST['InputBreedte_13'];
	$InputBreedte_14 = $_POST['InputBreedte_14'];
	$InputBreedte_15 = $_POST['InputBreedte_15'];
	
	$InputDikte_1 = $_POST['InputDikte_1'];
	$InputDikte_2 = $_POST['InputDikte_2'];
	$InputDikte_3 = $_POST['InputDikte_3'];
	$InputDikte_4 = $_POST['InputDikte_4'];
	$InputDikte_5 = $_POST['InputDikte_5'];
	$InputDikte_6 = $_POST['InputDikte_6'];
	$InputDikte_7 = $_POST['InputDikte_7'];
	$InputDikte_8 = $_POST['InputDikte_8'];
	$InputDikte_9 = $_POST['InputDikte_9'];
	$InputDikte_10 = $_POST['InputDikte_10'];
	$InputDikte_11 = $_POST['InputDikte_11'];
	$InputDikte_12 = $_POST['InputDikte_12'];
	$InputDikte_13 = $_POST['InputDikte_13'];
	$InputDikte_14 = $_POST['InputDikte_14'];
	$InputDikte_15 = $_POST['InputDikte_15'];
	
	$InputLengte_1 = $_POST['InputLengte_1'];
	$InputLengte_2 = $_POST['InputLengte_2'];
	$InputLengte_3 = $_POST['InputLengte_3'];
	$InputLengte_4 = $_POST['InputLengte_4'];
	$InputLengte_5 = $_POST['InputLengte_5'];
	$InputLengte_6 = $_POST['InputLengte_6'];
	$InputLengte_7 = $_POST['InputLengte_7'];
	$InputLengte_8 = $_POST['InputLengte_8'];
	$InputLengte_9 = $_POST['InputLengte_9'];
	$InputLengte_10 = $_POST['InputLengte_10'];
	$InputLengte_11 = $_POST['InputLengte_11'];
	$InputLengte_12 = $_POST['InputLengte_12'];
	$InputLengte_13 = $_POST['InputLengte_13'];
	$InputLengte_14 = $_POST['InputLengte_14'];
	$InputLengte_15 = $_POST['InputLengte_15'];
	
	$InputAantal_1 = $_POST['InputAantal_1'];
	$InputAantal_2 = $_POST['InputAantal_2'];
	$InputAantal_3 = $_POST['InputAantal_3'];
	$InputAantal_4 = $_POST['InputAantal_4'];
	$InputAantal_5 = $_POST['InputAantal_5'];
	$InputAantal_6 = $_POST['InputAantal_6'];
	$InputAantal_7 = $_POST['InputAantal_7'];
	$InputAantal_8 = $_POST['InputAantal_8'];
	$InputAantal_9 = $_POST['InputAantal_9'];
	$InputAantal_10 = $_POST['InputAantal_10'];
	$InputAantal_11 = $_POST['InputAantal_11'];
	$InputAantal_12 = $_POST['InputAantal_12'];
	$InputAantal_13 = $_POST['InputAantal_13'];
	$InputAantal_14 = $_POST['InputAantal_14'];
	$InputAantal_15 = $_POST['InputAantal_15'];
	
	$OutputPrijsExclBtw_1 = $_POST['OutputPrijsExclBtw_1'];
	$OutputPrijsExclBtw_2 = $_POST['OutputPrijsExclBtw_2'];
	$OutputPrijsExclBtw_3 = $_POST['OutputPrijsExclBtw_3'];
	$OutputPrijsExclBtw_4 = $_POST['OutputPrijsExclBtw_4'];
	$OutputPrijsExclBtw_5 = $_POST['OutputPrijsExclBtw_5'];
	$OutputPrijsExclBtw_6 = $_POST['OutputPrijsExclBtw_6'];
	$OutputPrijsExclBtw_7 = $_POST['OutputPrijsExclBtw_7'];
	$OutputPrijsExclBtw_8 = $_POST['OutputPrijsExclBtw_8'];
	$OutputPrijsExclBtw_9 = $_POST['OutputPrijsExclBtw_9'];
	$OutputPrijsExclBtw_10 = $_POST['OutputPrijsExclBtw_10'];
	$OutputPrijsExclBtw_11 = $_POST['OutputPrijsExclBtw_11'];
	$OutputPrijsExclBtw_12 = $_POST['OutputPrijsExclBtw_12'];
	$OutputPrijsExclBtw_13 = $_POST['OutputPrijsExclBtw_13'];
	$OutputPrijsExclBtw_14 = $_POST['OutputPrijsExclBtw_14'];
	$OutputPrijsExclBtw_15 = $_POST['OutputPrijsExclBtw_15'];
	
	$Gewicht_1 = $_POST['Gewicht_1'];
	$Gewicht_2 = $_POST['Gewicht_2'];
	$Gewicht_3 = $_POST['Gewicht_3'];
	$Gewicht_4 = $_POST['Gewicht_4'];
	$Gewicht_5 = $_POST['Gewicht_5'];
	$Gewicht_6 = $_POST['Gewicht_6'];
	$Gewicht_7 = $_POST['Gewicht_7'];
	$Gewicht_8 = $_POST['Gewicht_8'];
	$Gewicht_9 = $_POST['Gewicht_9'];
	$Gewicht_10 = $_POST['Gewicht_10'];
	$Gewicht_11 = $_POST['Gewicht_11'];
	$Gewicht_12 = $_POST['Gewicht_12'];
	$Gewicht_13 = $_POST['Gewicht_13'];
	$Gewicht_14 = $_POST['Gewicht_14'];
	$Gewicht_15 = $_POST['Gewicht_15'];
	
	$OutputLangsteLengte = $_POST['OutputLangsteLengte'];
	$OutputVolumeTotaal = $_POST['OutputVolumeTotaal'];
	$OutputGewichtTotaal = $_POST['OutputGewichtTotaal'];
	$OutputKorting = $_POST['OutputKorting'];
	
	$OutputKortingKopie = $_POST['OutputKortingKopie'];
	$OutputMaterialenBrutoExclBTW = $_POST['OutputMaterialenBrutoExclBTW'];
	$OutputMaterialenKortingExclBTW = $_POST['OutputMaterialenKortingExclBTW'];
	$OutputMaterialenNettoExclBTW = $_POST['OutputMaterialenNettoExclBTW'];
	$OutputMaterialenBrutoBTW = $_POST['OutputMaterialenBrutoBTW'];
	$OutputMaterialenKortingBTW = $_POST['OutputMaterialenKortingBTW'];
	$OutputMaterialenNettoBTW = $_POST['OutputMaterialenNettoBTW'];
	$OutputMaterialenBrutoInclBTW = $_POST['OutputMaterialenBrutoInclBTW'];
	$OutputMaterialenKortingInclBTW = $_POST['OutputMaterialenKortingInclBTW'];
	$OutputMaterialenNettoInclBTW = $_POST['OutputMaterialenNettoInclBTW'];
	
	$OutputTransportExclBTW = $_POST['OutputTransportExclBTW'];
	$OutputTransportInclBTW = $_POST['OutputTransportInclBTW'];
	
	$IkWilBestellen = $_POST['IkWilBestellen'];
	$AfhalenOfBezorgen = $_POST['AfhalenOfBezorgen'];
	$OutputTotaalInclBTWKopie = $_POST['OutputTotaalInclBTWKopie'];
	$Bedrijfsnaam = $_POST['Bedrijfsnaam'];
	$Naam = $_POST['Naam'];
	$Adres = $_POST['Adres'];
	$POSTcode = $_POST['POSTcode'];
	$Woonplaats = $_POST['Woonplaats'];
	$Land = $_POST['Land'];
	$Telefoon = $_POST['Telefoon'];
	$Email = $_POST['Email'];
	$Opmerking = $_POST['Opmerking'];
	
	$Body = <<<EOD
$InputBreedte_1<br/>
$InputBreedte_2<br/>
$InputBreedte_3<br/>
$InputBreedte_4<br/>
$InputBreedte_5<br/>
$InputBreedte_6<br/>
$InputBreedte_7<br/>
$InputBreedte_8<br/>
$InputBreedte_9<br/>
$InputBreedte_10<br/>
$InputBreedte_11<br/>
$InputBreedte_12<br/>
$InputBreedte_13<br/>
$InputBreedte_14<br/>
$InputBreedte_15<br/>
<br/>
$InputDikte_1<br/>
$InputDikte_2<br/>
$InputDikte_3<br/>
$InputDikte_4<br/>
$InputDikte_5<br/>
$InputDikte_6<br/>
$InputDikte_7<br/>
$InputDikte_8<br/>
$InputDikte_9<br/>
$InputDikte_10<br/>
$InputDikte_11<br/>
$InputDikte_12<br/>
$InputDikte_13<br/>
$InputDikte_14<br/>
$InputDikte_15<br/>
<br/>
$InputLengte_1<br/>
$InputLengte_2<br/>
$InputLengte_3<br/>
$InputLengte_4<br/>
$InputLengte_5<br/>
$InputLengte_6<br/>
$InputLengte_7<br/>
$InputLengte_8<br/>
$InputLengte_9<br/>
$InputLengte_10<br/>
$InputLengte_11<br/>
$InputLengte_12<br/>
$InputLengte_13<br/>
$InputLengte_14<br/>
$InputLengte_15<br/>
<br/>
$InputAantal_1<br/>
$InputAantal_2<br/>
$InputAantal_3<br/>
$InputAantal_4<br/>
$InputAantal_5<br/>
$InputAantal_6<br/>
$InputAantal_7<br/>
$InputAantal_8<br/>
$InputAantal_9<br/>
$InputAantal_10<br/>
$InputAantal_11<br/>
$InputAantal_12<br/>
$InputAantal_13<br/>
$InputAantal_14<br/>
$InputAantal_15<br/>
<br/>
$OutputPrijsExclBtw_1<br/>
$OutputPrijsExclBtw_2<br/>
$OutputPrijsExclBtw_3<br/>
$OutputPrijsExclBtw_4<br/>
$OutputPrijsExclBtw_5<br/>
$OutputPrijsExclBtw_6<br/>
$OutputPrijsExclBtw_7<br/>
$OutputPrijsExclBtw_8<br/>
$OutputPrijsExclBtw_9<br/>
$OutputPrijsExclBtw_10<br/>
$OutputPrijsExclBtw_11<br/>
$OutputPrijsExclBtw_12<br/>
$OutputPrijsExclBtw_13<br/>
$OutputPrijsExclBtw_14<br/>
$OutputPrijsExclBtw_15<br/>
<br/>
$Gewicht_1<br/>
$Gewicht_2<br/>
$Gewicht_3<br/>
$Gewicht_4<br/>
$Gewicht_5<br/>
$Gewicht_6<br/>
$Gewicht_7<br/>
$Gewicht_8<br/>
$Gewicht_9<br/>
$Gewicht_10<br/>
$Gewicht_11<br/>
$Gewicht_12<br/>
$Gewicht_13<br/>
$Gewicht_14<br/>
$Gewicht_15<br/>
<br/>
$OutputLangsteLengte<br/>
$OutputVolumeTotaal<br/>
$OutputGewichtTotaal<br/>
$OutputKorting<br/>
<br/>
$OutputKortingKopie<br/>
$OutputMaterialenBrutoExclBTW<br/>
$OutputMaterialenKortingExclBTW<br/>
$OutputMaterialenNettoExclBTW<br/>
$OutputMaterialenBrutoBTW<br/>
$OutputMaterialenKortingBTW<br/>
$OutputMaterialenNettoBTW<br/>
$OutputMaterialenBrutoInclBTW<br/>
$OutputMaterialenKortingInclBTW<br/>
$OutputMaterialenNettoInclBTW<br/>
<br/>
$OutputTransportExclBTW<br/>
$OutputTransportInclBTW<br/>
<br/>
$IkWilBestellen<br/>
$AfhalenOfBezorgen<br/>
$OutputTotaalInclBTWKopie<br/>
$Bedrijfsnaam<br/>
$Naam<br/>
$Adres<br/>
$Postcode<br/>
$Woonplaats<br/>
$Land<br/>
$Telefoon<br/>
$Email<br/>
$Opmerking<br/>
EOD;

  mail( $EmailTo, $EmailSubject, $Body, "From: $Email" );
  header( "Location: http://www.headerhere.com" );
?>
The email that I receive using this code doesn't show any results. Any ideas? Thanks a lot.
Last edited by JeffK on Tue May 11, 2010 8:53 am, edited 1 time in total.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: PHP Mail problem

Post by AbraCadaver »

Do you get any notices? Comment out the redirect and use at the top:

Code: Select all

error_reporting(E_ALL);
ini_set('display_errors', '1');
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
JeffK
Forum Newbie
Posts: 3
Joined: Tue May 11, 2010 8:42 am

Re: PHP Mail problem

Post by JeffK »

Thanks for the quick reply.

After inserting the code, I get this in almost every single line:

Notice: Undefined index

I use javascript in the form to calculate the results for some fields, could that be a problem?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: PHP Mail problem

Post by AbraCadaver »

Does your form have method="post"? If not then it defaults to "get" I believe.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
JeffK
Forum Newbie
Posts: 3
Joined: Tue May 11, 2010 8:42 am

Re: PHP Mail problem

Post by JeffK »

I have removed enctype="text/plain" and everything works fine now. Thanks.
Post Reply