johnmerlino1 Posted July 26, 2014 Share Posted July 26, 2014 I have following script: <?php $tireqty = isset($_POST['tireqty']) ? $_POST['tireqty'] : null; $oilqty = isset($_POST['oilqty']) ? $_POST['tireqty'] : null; echo "<p>order processed on " . date("F d, Y g:sA") . "</p>"; if($tireqty){ echo "tire quantity " . $tireqty; } if($oilqty){ echo "oil quantity " . $oilqty; } echo <<<theEnd Thank you for visiting our store and buying $tireqty tires and 3 $oilqty. Have a very nice day. theEnd; ?> Aptana shows error for the last "?>" as soon as I add the heredocs and when running it in browser, I get the following error: Parse error: syntax error, unexpected $end in /home/myuser/public_html/shopwithus.com/controllers/orders_controller.php on line 20 What might I be doing wrong? Quote Link to comment Share on other sites More sharing options...
fastsol Posted July 26, 2014 Share Posted July 26, 2014 In my opinion, using heredocs in the first place is the problem. The syntax is always a pain to get right. What's so hard with doing this echo 'Thank you for visiting our store and buying '.$tireqty.' and 3 '.$oilqty.'. Have a very nice day'; Quote Link to comment Share on other sites More sharing options...
Solution trq Posted July 27, 2014 Solution Share Posted July 27, 2014 Your closing theEnd needs to be at the start of the line. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.