PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/users/modelair/modelaircraft.co.nz/htdocs/summary.php on line 156
156 = if(isset($_COOKIE["cartId"]))
the code before worked perfectly before i put it in this function. are there rules or stuff like that to think about when doing this?
and could someone help me with the above problem and how i can avoid this in future? bound to run into more in this function.
<?php
#******************************************************************************
# This function prints a blank purchase form.
#******************************************************************************
function print_form()
{
print <<<HTMLEOF
<html>
<head>
<title>Direct Payment Solutions: Secure Payments Page PHP Sample</title>
</head>
<body>
<h1>Direct Payment Solutions: Secure Payments Page PHP Sample</h1>
<p>
You have indicated you would like to buy some widgets.
</p>
<p>
Please enter the number of widgets below, and enter your
shipping details.
</p>
<form method="post">
<table>
<tr>
<td>Quantity:</td>
<td><input name="Quantity" type="text"/></td>
<td>@ \$1.20 ea</td>
</tr>
<tr>
<td>Ship to</td>
<td></td>
</tr>
<tr>
<td>Address:</td>
<td><input name="Address1" type="text"/></td>
</tr>
<tr>
<td>City:</td>
<td><input name="Address2" type="text"/></td>
</tr>
</table>
<input name="Submit" type="submit" value="Submit"/>
Click submit to go to the secure payment page.
</form>
</body>
</html>
HTMLEOF;
}
#*****************************************************************************
?>
ok.. since you want to run code inside the function, lose the heredoc junk (print <<<HTMLEOF).. just code like normal. Have it echo out whatever it needs to, 'cause that's what your heredoc code example does.
ok thanx feyd, this is not my code, its a payment company type place.. so i just loose the print <<<HTMLEOF) and code like normal ok i think i can handle that!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Model Aircraft</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css" media="all">
@import url(Payment%20Express/model.css);
</style>
<script type="text/javascript">
<!--
function getWindowHeight() {
dumping text to the browser is often done through the heredoc... but you don't put actual code inside the heredoc block. it's supposed to be around the heredoc, otherwise it won't be processed like normal code. so:
thanx feyd for all your help! that should solve it will oook at it after work. one more small thing though.. what happens if i have some php in the heredoc? u know posting variables etc?
post more code please.. as those put together (removing the last brace) works just fine. although it may output a bit different than you think.. (the php start and end tags print out. )