putting php array into html code -
i use template php system, called smarty. not able smarty have manually have forgotten how , possible....
<? foreach ($searchresults $row) { ?> <tr class="tablerows"> <td><img style="cursor: pointer;" src="img/expand.png" id="1" alt="hidden" onclick="changesign()" /></td> <td><a href="#"><? echo $row[0]; ?></a></td> <td><? echo $row[1]; ?></td> <td><? echo $row[2]; ?></td> <td><? echo $row[3]; ?></td> <td><? echo $row[4]; ?></td> <td><input type="button" value="delete" class="deletebtn" /></td> </tr> <? } ?> </table> </fieldset> <?php } ?>
this doesn't work. wondering how can make work. want put arrays data rows.
( forgot echo @ start of question, did try , have updated such still not working)
the issue nothing being put out, array contains data sure when var_dump spits out:
array(10) { [0]=> string(4) "3344" ["purchaseno"]=> string(4) "3344" [1]=> string(10) "2013-03-31" ["datecreated"]=> string(10) "2013-03-31" [2]=> string(4) "john" ["name"]=> string(4) "john" [3]=> string(5) "mold1" ["mouldname"]=> string(5) "mold1" [4]=> null ["couriername"]=> null }
try echo before $row[1] <?php echo $row[1]; ?>
so answer is:
<? foreach ($searchresults $row) { ?> <tr class="tablerows"> <td><img style="cursor: pointer;" src="img/expand.png" id="1" alt="hidden" onclick="changesign()" /></td> <td><a href="#"><?php echo $row[0]; ?></a></td> <td><?php echo $row[1]; ?></td> <td><?php echo $row[2]; ?></td> <td><?php echo $row[3]; ?></td> <td><?php echo $row[4]; ?></td> <td><input type="button" value="delete" class="deletebtn" /></td> </tr> <? } ?>
Comments
Post a Comment