Solved

T_DNUMBER, expecting ']'

Posted on 2008-10-31
4
280 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:cmscheetz
  • 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:cmscheetz
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:cmscheetz
ID: 31512155
Thank you very much
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
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 dynamically set the form action using jQuery.

947 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now