I am trying to add an "Add to wishlist" button next to every record from a database. If I add the form tags inside the loop it comes up with an error asking to place ";" inside action. If I add the button outside the loop it is shown only once. What am I doing wrong ?
EDIT: the error I get is Parse error: syntax error, unexpected ''>' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in /home/sta402/PHP_stuff/CarTemplate/Views/CarList.phtml on line 16
and the underlined part of the code is between the quotation marks after "action" in the form for the button.
<?php require('template/header.phtml') ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<br>
<table class="table table-hover">
<thead>
<tr><th>Type</th><th>Make</th><th>Model</th><th>Colour</th><th>Price</th><th>Year</th><th>Picture</th></tr>
</thead>
<tbody>
<?php foreach ($view->carDataSet as $carData) {
echo '<tr> <td>' . $carData->getType() . '</td> <td>' . $carData->getMake() . '</td> <td>' . $carData->getModel() . '</td> <td>' . $carData->getColour() .'</td> <td>' . $carData->getPrice() . '</td> <td>' . $carData->getYearOfRegistration() . '</td><td>' . $carData->getPicture() . '</td></tr>';
} ?>
<form method="POST" action=''>
<input type="submit" name="button1" value="My Button">
</form>
</tbody>
</table>
</form>
<?php require('template/footer.phtml') ?>