Jump to content

Problem with ending a print()....? *SOLVED*


pocobueno1388

Recommended Posts

For some reason my print() isn't working correctly. When I print a large amount of text to the screen I use this:

[code]

print<<<HERE

text text blah blah

HERE;
[/code]

Here is the code I am having trouble with:

[code]
<?php

print<<<HERE

<TABLE class='main' cellspacing=5>

<TD class='main' align='center'>

$row4[image_url]<br>
<b>$row3[item_name]</b><br>

<b>Uses:</b> $row3[uses]<p>

<i>$row4[description]</i><p></td><TR class='main' align='center'>


<form action="inventory.php?itemID=$item" method="post">
<td>
HERE; ========================================//NOT ENDING!

if ($row3[tack_type] != no){
echo "<a href='inventory_old.php?itemID=$item&action=equip'>equip $row3[item_name]</a><br>";
} else {
echo "<a href='inventory_old.php?itemID=$item&action=use'>Use $row3[item_name]</a><br>";
}


print<<<HERE
<a href="inventory_old.php?itemID=$item&action=shop">Put into your shop</a><br>
<a href="inventory_old.php?itemID=$item&action=delete">Discard</a><br>
</td>

</form>
</table>

HERE;

?>
[/code]

and this is what it displays to the screen:

[tt]

HERE; if (collar != no){ echo "equip Brown Collar
"; } else { echo "Use Brown Collar
"; } print<<Put into your shop
Discard

[/tt]

its almost as if the print isn't ending with the HERE;

Any help is greatly appreciated XD Thanks.
Link to comment
https://forums.phpfreaks.com/topic/27040-problem-with-ending-a-print-solved/
Share on other sites

Try...

[code=php:0]
<?php

print <<<HERE

<TABLE class='main' cellspacing=5>

<TD class='main' align='center'>

{$row4['image_url']}<br>
<b>{$row3['item_name']}</b><br>

<b>Uses:</b> {$row3['uses']}<p>

<i>{$row4['description']}</i><p></td><TR class='main' align='center'>


<form action="inventory.php?itemID=$item" method="post">
<td>
HERE;
[/code]

Notice the space after print? You might also notice I fixed all your errors with regard to array indexees not being in quotes.
That seemed to get rid of that error, but now the print below that one won't close.

[tt]Parse error: syntax error, unexpected T_SL in /home/colin/public_html/inventory_old.php on line 193[/tt]

Here is the code to that part:

[code]
<?php

print <<<HERE //=============Line 193

<a href="inventory_old.php?itemID=$item&action=shop">Put into your shop</a><br>
<a href="inventory_old.php?itemID=$item&action=delete">Discard</a><br>
</td>

</form>
</table>

HERE;

?>
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.