Can't help you with Drupal, but here's the new thinking you need to develop: PHP is entirely different from HTML because PHP is only meaningful on the server, before anything is sent to the browser. Your web server (Apache or IIS) parses any PHP contained in a file and generally outputs HTML (and perhaps Javascript) to the browser. The PHP is no longer part of what the browser sees.
So when you ask how to insert PHP into HTML, that doesn't mean much. What you do is to use PHP to determine what HTML to send to the browser.
You can either use PHP's echo (or print) commands to send whatever you want--HTML or Javascript or whatever--to the browser, or you can mix PHP into your HTML where you need to insert some variable bit of HTML or plain text or whatever. Whenever the web server sees <?php it begins parsing the PHP until it sees ?>.
So, you can do something like this: PHP Code:
...
<table>
<tr>
<td>Hello World</td>
</tr>
<?php
if($_GET['mydata']=='romeo') {
echo "<tr><td>Hello, Romeo</td></tr>";
}
?>
</table>
...
don94403, January 14th, 2009 08:54 PM
Bookmarks