/ Published in: PHP
The above example uses PHP's heredoc syntax. With it, we can completely eliminate PHP tags from the insides of HTML tags.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php foreach ($contacts as $contact_object) { foreach ($contact_array as $key=>$value) $$key = h($value); echo <<<END_ROW <tr> <td>$id</td> <td>$first_name</td> <td>$last_name</td> <td>$phone</td> <td> <a href="?action=edit&id=$id">edit</a> <a href="?action=delete&id=$id">delete</a> </td> </tr> END_ROW; }
URL: http://pdxphp.org/articles/escaping-injected-data