Jump to content

Recommended Posts

My code is below but it wont process, the submit button goes to 'process.php' and not through to confirm.html and send email?

 

 

--------------------------------------------------------------------------------------

<?php
// The message
$message = "Full Name: {$_POST['NAME']}\n
Address: {$_POST['ADDRESS']}\n
Town: {$_POST['TOWN']}\n
Post Code: {$_POST['POSTCODE']}\n
Phone Number: {$_POST['PHONE']}\n
Email: {$_POST['email']}\n

$Line 1;
Page Number: {$_POST['PageNumber']}\n
Product Code: {$_POST['ProductCode']}\n
Product Description: {$_POST['Description']}\n
Price (£): {$_POST['Price']}\n
Quantity: {$_POST['Quantity']}";
Total: {$_POST['Total']}";


$Line 2;
Page Number: {$_POST['PageNumber2']}\n
Product Code: {$_POST['ProductCode2']}\n
Product Description: {$_POST['Description2']}\n
Price (£): {$_POST['Price2']}\n
Quantity: {$_POST['Quantity2']}";
Total: {$_POST['Total2']}";


$Line 3;
Page Number: {$_POST['PageNumber3']}\n
Product Code: {$_POST['ProductCode3']}\n
Product Description: {$_POST['Description3']}\n
Price (£): {$_POST['Price3']}\n
Quantity: {$_POST['Quantity3']}";
Total: {$_POST['Total3']}";


$Line 4;
Page Number: {$_POST['PageNumber4']}\n
Product Code: {$_POST['ProductCode4']}\n
Product Description: {$_POST['Description4']}\n
Price (£): {$_POST['Price4']}\n
Quantity: {$_POST['Quantity4']}";
Total: {$_POST['Total4']}";



$Line 5;
Page Number: {$_POST['PageNumber5']}\n
Product Code: {$_POST['ProductCode5']}\n
Product Description: {$_POST['Description5']}\n
Price (£): {$_POST['Price5']}\n
Quantity: {$_POST['Quantity5']}";
Total: {$_POST['Total5']}";


$Line 6;
Page Number: {$_POST['PageNumber6']}\n
Product Code: {$_POST['ProductCode6']}\n
Product Description: {$_POST['Description6']}\n
Price (£): {$_POST['Price6']}\n
Quantity: {$_POST['Quantity6']}";
Total: {$_POST['Total6']}";



$Line 7;
Page Number: {$_POST['PageNumber7']}\n
Product Code: {$_POST['ProductCode7']}\n
Product Description: {$_POST['Description7']}\n
Price (£): {$_POST['Price7']}\n
Quantity: {$_POST['Quantity7']}";
Total: {$_POST['Total7']}";



$Line 8;
Page Number: {$_POST['PageNumber8']}\n
Product Code: {$_POST['ProductCode8']}\n
Product Description: {$_POST['Description8']}\n
Price (£): {$_POST['Price8']}\n
Quantity: {$_POST['Quantity8']}";
Total: {$_POST['Total8']}";


$Line 9;
Page Number: {$_POST['PageNumber9']}\n
Product Code: {$_POST['ProductCode9']}\n
Product Description: {$_POST['Description9']}\n
Price (£): {$_POST['Price9']}\n
Quantity: {$_POST['Quantity9']}";
Total: {$_POST['Total9']}";



$Line 10;
Page Number: {$_POST['PageNumber10']}\n
Product Code: {$_POST['ProductCode10']}\n
Product Description: {$_POST['Description10']}\n
Price (£): {$_POST['Price10']}\n
Quantity: {$_POST['Quantity10']}";
Total: {$_POST['Total10']}";





Grand Total: {$_POST['GrandTotal']}";




// Send
$success = "/confirm.html";
if( mail('dimension87@live.co.uk', 'Online Order', $message) ) {
   header('Location: ' . $success);
   exit();
}
?>

umm why all the {'s??? and the \n's and what not... are you trying to parse this for output?

 

If so, i would use the explode() and implode functions perhaps.

Also, dont do all of this in one message variable, maybe split it into header, body footer etc,

 

$addyInfo = $name. "\n". $street. "\n". $zip;
$BillinInfo = $name. "\n". $street. "\n". $zip. "\n". $CCard;

Something like that.  :-\

Then i would set all of you $_POST["Name"] data to $userName or some sort of easier variable or something of the sort.

 

anywhoo little more info would be great

It's got those as another user showed me that way to do it (im new and no use of php before :P)

 

the thing is it was processing and the format was fine. now i've finished the script/code to capture all the data and it doesnt work any more.

 

you click the confirm button and it just goes to /process.php rather than the confirm page

if that is your exact code

 


Quantity: {$_POST['Quantity']}";
Total: {$_POST['Total']}";

 

is where your message ends first.

 

you continued this throughout the rest of it.  use of ' is fine, but once you use " it will end and your threw in your ; so php now thinks that message is really done and you are now passing all these variables out side of your string.  However.  It should still be going, but just not mailing you the whole "messages" variable.

 

 

You've randomly added the 'Total: . . . ' lines to the code without actually making them part of the preceding strings. And what are all the $Line 2;, $Line 3;, and such? Are those intended to be comments?

here is some code for a registration on a site.

 

<?php
$msg_subject = "TGR Registration";
$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
Welcome to TGR!\r
\r
Please click the link below to activate your account, if the link below doesn't work please copy and paste the code below\r
<a href='http://tgrdesigns.com/register.php?". $conf_code. "'>Register</a>\rCode: ". 
$conf_code. "\r\r
Thank you,\r\r The TGR Design Team
</body>
</html>";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

// More headers
$headers .= 'From: <register@TGRDesigns.com>' . "\r\n";
mail($_POST['emailName'], $msg_subject, $message, $headers);
echo "An email has been sent.  Thank you";

?>

 

Try something like that...  and you should be good.

The code you posted is barely recognizable. Based on what you have, i've cleaned it up enough that it should work. If you're genuinely interested in learning the language, there's many good books that can teach you the basics. I'd recommend Head First PHP from O'Reilly Media.

 

<?php
// The message
$message = "Full Name: $_POST[NAME]\n
Address: $_POST[ADDRESS]\n
Town: $_POST[TOWN]\n
Post Code: $_POST[postCODE]\n
Phone Number: $_POST[PHONE]\n
Email: $_POST[email]\n\n";

$message .= "Page Number: $_POST[PageNumber]\n
Product Code: $_POST[ProductCode]\n
Product Description: $_POST[Description]\n
Price (£): $_POST[Price]\n
Quantity: $_POST[Quantity]\n
Total: $_POST[Total]\n\n";

$message .= "Page Number: $_POST[PageNumber2]\n
Product Code: $_POST[ProductCode2]\n
Product Description: $_POST[Description2]\n
Price (£): $_POST[Price2]\n
Quantity: $_POST[Quantity2]\n
Total: $_POST[Total2]\n\n";

$message .= "Page Number: $_POST[PageNumber3]\n
Product Code: $_POST[ProductCode3]\n
Product Description: $_POST[Description3]\n
Price (£): $_POST[Price3]\n
Quantity: $_POST[Quantity3]\n
Total: $_POST[Total3]\n\n";

$message .= "Page Number: $_POST[PageNumber4]\n
Product Code: $_POST[ProductCode4]\n
Product Description: $_POST[Description4]\n
Price (£): $_POST[Price4]\n
Quantity: $_POST[Quantity4]\n
Total: $_POST[Total4]\n\n";

$message .= "Page Number: $_POST[PageNumber5]\n
Product Code: $_POST[ProductCode5]\n
Product Description: $_POST[Description5]\n
Price (£): $_POST[Price5]\n
Quantity: $_POST[Quantity5]\n
Total: $_POST[Total5]\n\n";

$message .= "Page Number: $_POST[PageNumber6]\n
Product Code: $_POST[ProductCode6]\n
Product Description: $_POST[Description6]\n
Price (£): $_POST[Price6]\n
Quantity: $_POST[Quantity6]\n
Total: $_POST[Total6]\n\n";

$message .= "Page Number: $_POST[PageNumber7]\n
Product Code: $_POST[ProductCode7]\n
Product Description: $_POST[Description7]\n
Price (£): $_POST[Price7]\n
Quantity: $_POST[Quantity7]\n
Total: $_POST[Total7]\n\n";

$message .= "Page Number: $_POST[PageNumber8]\n
Product Code: $_POST[ProductCode8]\n
Product Description: $_POST[Description8]\n
Price (£): $_POST[Price8]\n
Quantity: $_POST[Quantity8]\n
Total: $_POST[Total8]\n\n";

$message .= "Page Number: $_POST[PageNumber9]\n
Product Code: $_POST[ProductCode9]\n
Product Description: $_POST[Description9]\n
Price (£): $_POST[Price9]\n
Quantity: $_POST[Quantity9]\n
Total: $_POST[Total9]\n\n";

$message .= "Page Number: $_POST[PageNumber10]\n
Product Code: $_POST[ProductCode10]\n
Product Description: $_POST[Description10]\n
Price (£): $_POST[Price10]\n
Quantity: $_POST[Quantity10]\n
Total: $_POST[Total10]\n\n";

$message .= "Grand Total: $_POST[GrandTotal]";

// Send
$success = "/confirm.html";
if (mail('dimension87@live.co.uk', 'Online Order', $message)) {
   header('Location: ' . $success);
   exit();
}
?>

The code you posted is barely recognizable. Based on what you have, i've cleaned it up enough that it should work. If you're genuinely interested in learning the language, there's many good books that can teach you the basics. I'd recommend Head First PHP from O'Reilly Media.

 

<?php
// The message
$message = "Full Name: $_POST[NAME]\n
Address: $_POST[ADDRESS]\n
Town: $_POST[TOWN]\n
Post Code: $_POST[postCODE]\n
Phone Number: $_POST[PHONE]\n
Email: $_POST[email]\n\n";

$message .= "Page Number: $_POST[PageNumber]\n
Product Code: $_POST[ProductCode]\n
Product Description: $_POST[Description]\n
Price (£): $_POST[Price]\n
Quantity: $_POST[Quantity]\n
Total: $_POST[Total]\n\n";

$message .= "Page Number: $_POST[PageNumber2]\n
Product Code: $_POST[ProductCode2]\n
Product Description: $_POST[Description2]\n
Price (£): $_POST[Price2]\n
Quantity: $_POST[Quantity2]\n
Total: $_POST[Total2]\n\n";

$message .= "Page Number: $_POST[PageNumber3]\n
Product Code: $_POST[ProductCode3]\n
Product Description: $_POST[Description3]\n
Price (£): $_POST[Price3]\n
Quantity: $_POST[Quantity3]\n
Total: $_POST[Total3]\n\n";

$message .= "Page Number: $_POST[PageNumber4]\n
Product Code: $_POST[ProductCode4]\n
Product Description: $_POST[Description4]\n
Price (£): $_POST[Price4]\n
Quantity: $_POST[Quantity4]\n
Total: $_POST[Total4]\n\n";

$message .= "Page Number: $_POST[PageNumber5]\n
Product Code: $_POST[ProductCode5]\n
Product Description: $_POST[Description5]\n
Price (£): $_POST[Price5]\n
Quantity: $_POST[Quantity5]\n
Total: $_POST[Total5]\n\n";

$message .= "Page Number: $_POST[PageNumber6]\n
Product Code: $_POST[ProductCode6]\n
Product Description: $_POST[Description6]\n
Price (£): $_POST[Price6]\n
Quantity: $_POST[Quantity6]\n
Total: $_POST[Total6]\n\n";

$message .= "Page Number: $_POST[PageNumber7]\n
Product Code: $_POST[ProductCode7]\n
Product Description: $_POST[Description7]\n
Price (£): $_POST[Price7]\n
Quantity: $_POST[Quantity7]\n
Total: $_POST[Total7]\n\n";

$message .= "Page Number: $_POST[PageNumber8]\n
Product Code: $_POST[ProductCode8]\n
Product Description: $_POST[Description8]\n
Price (£): $_POST[Price8]\n
Quantity: $_POST[Quantity8]\n
Total: $_POST[Total8]\n\n";

$message .= "Page Number: $_POST[PageNumber9]\n
Product Code: $_POST[ProductCode9]\n
Product Description: $_POST[Description9]\n
Price (£): $_POST[Price9]\n
Quantity: $_POST[Quantity9]\n
Total: $_POST[Total9]\n\n";

$message .= "Page Number: $_POST[PageNumber10]\n
Product Code: $_POST[ProductCode10]\n
Product Description: $_POST[Description10]\n
Price (£): $_POST[Price10]\n
Quantity: $_POST[Quantity10]\n
Total: $_POST[Total10]\n\n";

$message .= "Grand Total: $_POST[GrandTotal]";

// Send
$success = "/confirm.html";
if (mail('dimension87@live.co.uk', 'Online Order', $message)) {
   header('Location: ' . $success);
   exit();
}
?>[/email]

 

What are you talking about, he did a better job than you. All you did was unquote all his ASSOCIATIVE array keys to make PHP treat them as constants...

<?php
// The message
$message = <<<MSG
Full Name: {$_POST['NAME']}
Address: {$_POST['ADDRESS']}
Town: {$_POST['TOWN']}
Post Code: {$_POST['POSTCODE']}
Phone Number: {$_POST['PHONE']}
Email: {$_POST['email']}


Page Number: {$_POST['PageNumber']}
Product Code: {$_POST['ProductCode']}
Product Description: {$_POST['Description']}
Price (£): {number_format($_POST['Price'], 2)}
Quantity: {$_POST['Quantity']}
Total: {number_format($_POST['Total'], 2)}


Page Number: {$_POST['PageNumber2']}
Product Code: {$_POST['ProductCode2']}
Product Description: {$_POST['Description2']}
Price (£): {number_format($_POST['Price2'], 2)}
Quantity: {$_POST['Quantity2']}
Total: {number_format($_POST['Total2'], 2)}


Page Number: {$_POST['PageNumber3']}
Product Code: {$_POST['ProductCode3']}
Product Description: {$_POST['Description3']}
Price (£): {number_format($_POST['Price3'], 2)}
Quantity: {$_POST['Quantity3']}
Total: {number_format($_POST['Total3'], 2)}


Page Number: {$_POST['PageNumber4']}
Product Code: {$_POST['ProductCode4']}
Product Description: {$_POST['Description4']}
Price (£): {number_format($_POST['Price4'], 2)}
Quantity: {$_POST['Quantity4']}
Total: {number_format($_POST['Total4'], 2)}


Page Number: {$_POST['PageNumber5']}
Product Code: {$_POST['ProductCode5']}
Product Description: {$_POST['Description5']}
Price (£): {number_format($_POST['Price5'], 2)}
Quantity: {$_POST['Quantity5']}
Total: {number_format($_POST['Total5'], 2)}


Page Number: {$_POST['PageNumber6']}
Product Code: {$_POST['ProductCode6']}
Product Description: {$_POST['Description6']}
Price (£): {number_format($_POST['Price6'], 2)}
Quantity: {$_POST['Quantity6']}
Total: {number_format($_POST['Total6'], 2)}


Page Number: {$_POST['PageNumber7']}
Product Code: {$_POST['ProductCode7']}
Product Description: {$_POST['Description7']}
Price (£): {number_format($_POST['Price7'], 2)}
Quantity: {$_POST['Quantity7']}
Total: {number_format($_POST['Total7'], 2)}


Page Number: {$_POST['PageNumber8']}
Product Code: {$_POST['ProductCode8']}
Product Description: {$_POST['Description8']}
Price (£): {number_format($_POST['Price8'], 2)}
Quantity: {$_POST['Quantity8']}
Total: {number_format($_POST['Total8'], 2)}


Page Number: {$_POST['PageNumber9']}
Product Code: {$_POST['ProductCode9']}
Product Description: {$_POST['Description9']}
Price (£): {number_format($_POST['Price9'], 2)}
Quantity: {$_POST['Quantity9']}
Total: {number_format($_POST['Total9'], 2)}


Page Number: {$_POST['PageNumber10']}
Product Code: {$_POST['ProductCode10']}
Product Description: {$_POST['Description10']}
Price (£): {number_format($_POST['Price10'], 2)}
Quantity: {$_POST['Quantity10']}
Total: {number_format($_POST['Total10'], 2)}


Grand Total: {number_format($_POST['GrandTotal'], 2)}
MSG;


$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/plain;charset=iso-8859-1" . "\r\n";
$headers .= "From: <no-reply@" . $_SERVER['SERVER_NAME'] . ">" . "\r\n";
$headers .= "Reply-To: no-reply@" . $_SERVER['SERVER_NAME']  . "\r\n";

// Send
$success = "/confirm.html";
if( mail('dimension87@live.co.uk', 'Online Order', $message, $headers) ) {
   header('Location: ' . $success);
   exit();
}
?>

 

//EDIT Added headers

Form: (apologies if it seems abit all over the place)

  <form>

  <form action="process.php" method="post">

  <tr bordercolor="#F5F4FD" bgcolor="#C7CFE9">

    <td colspan="4" class="style17"><div align="left"><strong> NAME   

     

      <strong>

          <input name="NAME" type="text" />

        </strong></strong></div></td>

    <td width="60"> </td>

  <tr bordercolor="#F5F4FD" bgcolor="#C7CFE9">

    <td colspan="4" class="style17"><div align="left"><strong>ADDRESS </strong>

        <input name="ADDRESS" type="text" />

    </div></td>

    <td class="style15"> </td>

  </tr>

  <tr bordercolor="#F5F4FD" bgcolor="#C7CFE9">

    <td height="24" colspan="4" class="style17"><div align="left"><strong>TOWN </strong>

        <input name="TOWN" type="text" />

    </div></td>

    <td class="style15"> </td>

  </tr>

  <tr bordercolor="#F5F4FD" bgcolor="#C7CFE9">

    <td height="24" colspan="4" class="style17"><div align="left"><strong>POSTCODE</strong>

        <input name="POSTCODE" type="text" />

    </div></td>

    <td class="style15"> </td>

  </tr>

  <tr bordercolor="#F5F4FD" bgcolor="#C7CFE9">

    <td height="27" colspan="4" class="style17"><div align="left"><strong>PHONE </strong>

        <input name="PHONE" type="number" />

    </div></td>

    <td class="style15"> </td>

  </tr>

  <tr bordercolor="#F5F4FD" bgcolor="#C7CFE9">

    <td height="24" colspan="4" class="style17"><p align="left"><strong>EMAIL </strong>

          <input name="email" type="text" /></td>

    <td class="style15"> </td>

  </tr>

  <tr bgcolor="#F5F4FD">

    <td width="68">Item Number </td>

    <td width="60">Page Number </td>

    <td width="144">Product Code </td>

    <td width="210">Description</td>

    <td>Price</td>

    <td width="45">QTY</td>

    <td width="51">Total</td>

  </tr>

  <tr bgcolor="#F5F4FD">

    <td>1</td>

    <td><input name="PageNumber" type="text" size="10" /></td>

    <td><input name="ProductCode" type="text" /></td>

    <td><input name="Description" type="text" size="35" /></td>

    <td><input name="Price" type="text" size="10" /></td>

    <td bordercolor="#3E55A7"><input name="Quantity" type="text" size="10" /></td>

    <td><input name="Total" type="text" size="10" /></td>

  </tr>

  <tr bgcolor="#F5F4FD">

    <td>2</td>

    <td><input name="PageNumber2" type="text" size="10" /></td>

    <td><input name="ProductCode2" type="text" /></td>

    <td><input name="Description2" type="text" size="35" /></td>

    <td><input name="Price2" type="text" size="10" /></td>

    <td><input name="Quantity2" type="text" size="10" /></td>

    <td><input name="Total2" type="text" size="10" /></td>

  </tr>

  <tr bgcolor="#F5F4FD">

    <td>3</td>

    <td><input name="PageNumber3" type="text" size="10" /></td>

    <td><input name="ProductCode3" type="text" /></td>

    <td><input name="Description3" type="text" size="35" /></td>

    <td><input name="Price3" type="text" size="10" /></td>

    <td><input name="Quantity3" type="text" size="10" /></td>

    <td><input name="Total3" type="text" size="10" /></td>

  </tr>

  <tr bgcolor="#F5F4FD">

    <td>4</td>

    <td><input name="PageNumber4" type="text" size="10" /></td>

    <td><input name="ProductCode4" type="text" /></td>

    <td><input name="Description4" type="text" size="35" /></td>

    <td><input name="Price4" type="text" size="10" /></td>

    <td><input name="Quantity4" type="text" size="10" /></td>

    <td><input name="Total4" type="text" size="10" /></td>

  </tr>

  <tr bgcolor="#F5F4FD">

    <td>5</td>

    <td><input name="PageNumber5" type="text" size="10" /></td>

    <td><input name="ProductCode5" type="text" /></td>

    <td><input name="Description5" type="text" size="35" /></td>

    <td><input name="Price5" type="text" size="10" /></td>

    <td><input name="Quantity5" type="text" size="10" /></td>

    <td><input name="Total5" type="text" size="10" /></td>

  </tr>

  <tr bgcolor="#F5F4FD">

    <td>6</td>

    <td><input name="PageNumber6" type="text" size="10" /></td>

    <td><input name="ProductCode6" type="text" /></td>

    <td><input name="Description6" type="text" size="35" /></td>

    <td><input name="Price6" type="text" size="10" /></td>

    <td><input name="Quantity6" type="text" size="10" /></td>

    <td><input name="Total6" type="text" size="10" /></td>

  </tr>

  <tr bgcolor="#F5F4FD">

    <td>7</td>

    <td><input name="PageNumber7" type="text" size="10" /></td>

    <td><input name="ProductCode7" type="text" /></td>

    <td><input name="Description7" type="text" size="35" /></td>

    <td><input name="Price7" type="text" size="10" /></td>

    <td><input name="Quantity7" type="text" size="10" /></td>

    <td><input name="Total7" type="text" size="10" /></td>

  </tr>

  <tr bgcolor="#F5F4FD">

    <td>8</td>

    <td><input name="PageNumber8" type="text" size="10" /></td>

    <td><input name="ProductCode8" type="text" /></td>

    <td><input name="Description8" type="text" size="35" /></td>

    <td><input name="Price8" type="text" size="10" /></td>

    <td><input name="Quantity8" type="text" size="10" /></td>

    <td><input name="Total8" type="text" size="10" /></td>

  </tr>

  <tr bgcolor="#F5F4FD">

    <td>9</td>

    <td><input name="PageNumber9" type="text" size="10" /></td>

    <td><input name="ProductCode9" type="text" /></td>

    <td><input name="Description9" type="text" size="35" /></td>

    <td><input name="Price9" type="text" size="10" /></td>

    <td><input name="Quantity9" type="text" size="10" /></td>

    <td><input name="Total9" type="text" size="10" /></td>

  </tr>

  <tr bgcolor="#F5F4FD">

    <td>10</td>

    <td><input name="PageNumber10" type="text" size="10" /></td>

    <td><input name="ProductCode10" type="text" /></td>

    <td><input name="Description10" type="text" size="35" /></td>

    <td><input name="Price10" type="text" size="10" /></td>

    <td><input name="Quantity10" type="text" size="10" /></td>

    <td><input name="Total10" type="text" size="10" /></td>

  </tr>

  <tr bgcolor="#F5F4FD">

    <td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

    <td><div align="center" class="style1">Total:</div></td>

    <td> </td>

    <td><input name="GrandTotal" type="text" size="10" /></td>

  </tr>

  <tr bgcolor="#3E55A7">

    <td colspan="10" class="style9"> </td>

  </tr>

  <tr align="left" valign="top" bordercolor="#FFFFFF" bgcolor="#C7CFE9">

    <td colspan="10" class="style10"><br></td>

  </tr>

  <tr bgcolor="#3E55A7">

    <td colspan="10" class="style13"> </td>

  </tr>

  <tr bgcolor="#3E55A7">

 

    <td colspan="10" class="style13"><div align="center">

      <p> </p>

      <input type="submit" value='Submit' class='form_button'>

      <p> </p>

    </div></td>

</form>

 

 

Andy-H, perhaps you should brush up on your PHP fundamentals. See #4 below.

 

Based on the code he posted, without having seen the form markup, there is nothing wrong with what I posted.

 

1. I removed the literal brackets as they weren't needed.

2. I removed the line references as they didn't appear to have any relevance.

3. I broke the output up by order entries and re-quoted.

4. I removed the array key quotes because constants are not looked for inside strings. See http://php.net/manual/en/language.types.array.php

 

 

 

Andy-H, perhaps you should brush up on your PHP fundamentals. See #4 below.

 

4. I removed the array key quotes because constants are not looked for inside strings. See http://php.net/manual/en/language.types.array.php

 

I'd suggest that it's you who needs to "brush up" a little bit. Any unquoted string-type value in an array key that is not enclosed in quotes will be first treated as a constant by the php interpreter. When that ultimately fails, php will then revert to using it as a string.

 

<?php
$array['first'] = "string value";
echo $array[first];
?>

Produces error: 
[02-Nov-2010 21:31:20] PHP Notice:  Use of undefined constant first - assumed 'first' in /Applications/MAMP/htdocs/brad/test.php on line 3

[/code]

Pikachu2000, no disrespect but that's poor form to not have even looked at the code I posted before critiquing it. If you look back to what I posted on page 1, you'll see that it IS in double quotes.

 

Heres a snippet of what I posted:

$message = "Full Name: $_POST[NAME]\n
Address: $_POST[ADDRESS]\n
Town: $_POST[TOWN]\n
Post Code: $_POST[postCODE]\n
Phone Number: $_POST[PHONE]\n
Email: $_POST[email]\n\n";

$message .= "Page Number: $_POST[PageNumber]\n
Product Code: $_POST[ProductCode]\n
Product Description: $_POST[Description]\n
Price (£): $_POST[Price]\n
Quantity: $_POST[Quantity]\n
Total: $_POST[Total]\n\n";

 

Heres a reference from php.net:

// The following is okay, as it's inside a string. Constants are not looked for
// within strings, so no E_NOTICE occurs here
print "Hello $arr[fruit]";      // Hello apple

 

 

Now, in reply to the original poster, after using what you posted for the form markup, I can tell you that the problem your having is because you have an extra blank <form> element at the beginning. If you remove that from the markup, and then use the processing code exactly how I posted it, your form should work. I have tested this on a live server and received the email fine.

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.