PHP variable in HTML

Posted by Shek on April 17, 2008 under PHP | Be the First to Comment | Total View: 672 views

There are many times that you might like to use or include PHP variables within HTML codes, case like to use for a text box’s name, and the way to do so is:


Lets say you want to have a text box with name “namebox” and you want to use the PHP variable $textboxname to store the name, then you want to use the name for a HTML text field element:

1
2
3
4
<?php
$textboxname = namebox;
?>
<input type="text" name="<?php echo $textboxname;?>"/>

Don’t forget to included <?php and ?> to make it as a PHP statement.

Similar Posts:

VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

Add A Comment

*