problem with echoing this: echo("<input type="t
Posted: Sun Jan 26, 2003 7:46 pm
How can I use php's echo() to echo <input type="text" name="test">
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
echo '<input type="text" name="test">';No definitely don't do that - use double quotes around HTML attributes don't use single quotes.Sky wrote:Or put it like echo "<HTML STUFF='PROPERTY'....."; w or w/o ()'s
Code: Select all
<html><body>
<table>
<?php
$arr = array_map('sqrt', range(0,10));
foreach($arr as $num=>$sqrt)
{
?>
<tr>
<td><?php echo $num; ?></td>
<td><?php echo $sqrt; ?></td>
</tr>
<?php
}
?>
</table>
</body></html>Code: Select all
<?=$num?>Code: Select all
<? echo $code; ?>Don't forget that you must have short tags enabled to use this method - this can be disabled.DeGauss wrote:You can also use...
instead of...Code: Select all
<?=$num?>
Which is useful if you have a small piece of PHP output and a buttload of HTML.Code: Select all
<? echo $code; ?>