Jump to content

Recommended Posts

1 hour ago, makamo66 said:

When I echo out my variable in the php file it works fine but when I put the variable in a table cell it doesn't echo out. 
 

What exactly are you telling us?  An echo is an echo.  What is the problem here?   The real problem is that you aren't giving us anything to look at in order to help you.  Does that make sense to you?

<table border='1'><tr><th>Remove&nbsp;&nbsp;&nbsp;</th><th width='100'>Your Product&nbsp;&nbsp;</th><th>Quantity</th><th>Description</th><th>Price per item</th><th>Sub Total</th></tr>

<?php

echo "<form method='post' name='yourForm'>";

echo "<tr><td></td>";

echo "<td><img src=" . $thumbnail .   "/></td>";

echo "<td>" . $cart_product_quantity . "</td>";

echo "<td> " . $product . "(s)&nbsp;&nbsp;</td>";

echo "<td> \$" . $price . "</td><td> \$" . $number .  "</td></tr>";

echo "</form>";

echo "</table>";
 

Try running this code.  I've added an echo at the start and end to give you at least something to 'see' if it is actually running.  If it is not, then you need to find the errors.  AND get your ini file updated to allow you to turn on error checking when you need it.

<?php
echo "Script is beginning<br>";
$code=<<<heredocs
<table border='1'>
<tr>
<th>Remove&nbsp;&nbsp;&nbsp;</th>
<th width='100'>Your Product&nbsp;&nbsp;</th>
<th>Quantity</th>
<th>Description</th>
<th>Price per item</th>
<th>Sub Total</th>
</tr>
<form method='post' name='yourForm'>
<tr><td></td>
<td><img src="$thumbnail"/></td>
<td>$cart_product_quantity</td>
<td>{$product}(s)&nbsp;&nbsp;</td>
<td>${$price}</td>
<td>${$number}</td>
</tr>
</form>
</table>
heredocs;
echo $code;
echo "<br>Script finished";

When you test this and have problems, show us the code as you ran it and be sure to show us how those vars are being set!

 

Alas, {}s are part of the variable variable syntax

edit:

$a = 'foo';
$$a = 'bar';

echo $$a;       //--> bar
echo ${$a};     //--> bar
echo $foo;      //--> bar

 

Edited by Barand
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.