Solved

T_DNUMBER, expecting ']'

Posted on 2008-10-31
4
279 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you very much
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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 …

771 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

14 Experts available now in Live!

Get 1:1 Help Now