Reputation: 55
I have this next code and it doesn't print the value for the var $item
. how do i make it return the value of item.
<?php
$item = "wewewe";
$plu = $_POST[‘plu’];
$img = $_POST[‘img’];
$password = $_POST[‘password’];
echo '<tr>
<td><input type="checkbox"></td>
<td>'.$item.' </td>
<td>666</td>
<td> <img src="apple.jpg" alt=""> </td>
</tr>'
?>
Upvotes: 1
Views: 44
Reputation: 772
In php, if you want to print a value or a variable you have to use the "echo" keyword.
Try this :
<?php echo '
<tr>
<td><input type="checkbox"></td>
<td> '.$item.' </td>
<td>666</td>
<td> <img src="apple.jpg" alt=""> </td>
</tr>'; ?>
Upvotes: 0
Reputation: 3507
Try this:
<?php
$item = "wewewe";
$plu = (isset($_POST['plu']))?$_POST['plu']:'';
$img = (isset($_POST['img']))?$_POST['img']:'';
$password = (isset($_POST['password']))?$_POST['password']:'';
?>
<tr>
<td><input type="checkbox"></td>
<td><?= $item ?></td>
<td>666</td>
<td> <img src="apple.jpg" alt=""> </td>
</tr>
Hope it helps.
Upvotes: 2