Solved

T_DNUMBER, expecting ']'

Posted on 2008-10-31
4
283 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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.  …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

756 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