Solved

T_DNUMBER, expecting ']'

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

803 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