Solved

T_DNUMBER, expecting ']'

Posted on 2008-10-31
4
284 Views
Last Modified: 2010-04-21
Here is the HTML part and the PHP part below it..  People are going to put a number in the quanity text box and javascript will calculate the total at the bottom of the page, based on the quanity per item.  Then there is a submit button at the bottom of the page that will send an email with the order on it, but i am getting an, "Parse error: syntax error, unexpected T_DNUMBER, expecting ']' in C:\Inetpub\wwwroot\phpscript\ati_merchandise_send.php on line 19", error when they hit submit.

<tr>
  <td class="form_col3" align="left">Cool Weather Caps</td>
  <td class="form_col3">$6.25</td>                                
          <td class="form_col3">
          <input name="PROD_CWC_6.25" type="text" tabindex="11" value="" size="5"  onChange="CalculateTotal(this.form)"  />                              
</tr>

<tr>
          <td class="form_col3"  align="left">Warm Weather Caps</td>
          <td class="form_col3" >$6.95</td>                                      
                    <td class="form_col3">
                    <input name="PROD_WWC_6.95" type="text" tabindex="12" value="" size="5" onChange="CalculateTotal(this.form)" />                        
</tr>

PHP Part
<?php include("includes/config.php"); ?>
<?php
$current_main_section = "ati";
$current_section = "";

$sendTo = $ati_merchandise;
$subject = "TII - American Transport, Inc. - Merchandise Request Submitted";

$headers = 'From: AAA@AAAA.com'."\r\n";

// Message for sender
$message = "Here are the details of the request:\n\n";
$message .= "Name: ".$_POST[First_Name]." ".$_POST[Last_Name]."\n";
$message .= "Agent/Tractor Number: ".$_POST[AgentTractor_Number]."\n";
$message .= "Address: \n".$_POST[Street]."\n".$_POST[City].", ".$_POST[State]."\n".$_POST[Zip]."\n";
$message .= "Phone: ".$_POST[Phone_Number]."\n";
$message .= "Email: ".$_POST[EmailAddress];
$message .= "\n\n";
$message .= "Cool Weather Caps ".$_POST[PROD_CWC_6.25]."\n";
$message .= "Warm Weather Caps ".$_POST[PROD_WWC_6.95]."\n";


mail($sendTo, $subject, $message, $headers);

header( 'Location: ati_merchandise_ty.php' ) ;
?>
0
Comment
Question by:Shawn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 4

Expert Comment

by:husker475
ID: 22853338
Try changing $_POST[PROD_CWC_6.25] to $_POST['PROD_CWC_6.25'], same with $_POST['PROD_WWC_6.95']. You should do the same to $_POST[First_Name] and the others as I'm guessing those are not constants but strings.
0
 
LVL 3

Author Comment

by:Shawn
ID: 22853379
It stopped the error, but it didn't populate the vaule in the email that is put into the text box.
0
 
LVL 4

Accepted Solution

by:
husker475 earned 125 total points
ID: 22857273
I just run a few tests and it seems the . (dot) in the name is being replaced by an _ (underscore). Try changing $_POST['PROD_CWC_6.25'] to $_POST['PROD_CWC_6_25'], or you could change the name on the input to avoid such problems.

Also, add this to your code so that you can see what the keys and values really look like:
echo '<pre>';
print_r($_POST);
echo '</pre>';

Open in new window

0
 
LVL 3

Author Closing Comment

by:Shawn
ID: 31512155
Thank you very much
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question