Embedding PHP Inside HTML |
Code for simple html form with php file extension (screenshot1):-
Code For Simple Html From With Php File Extension Screenshot1 |
<input type="text" value=" Hello World.">
output (Screenshot2) :-
Screenshot2 |
you will see a small text-box with echo hello world. Now in another example i will embedding php code with html by using variables of php and in values of html form i will use standard variable for string lets see how it will happens
Code for embedding PHP Inside Html (Screenshot3):-
Code for embedding PHP Inside Html Screenshot3 |
<?php
$text = 'Hello World.';
?>
<input type="text" value="<?php echo $text; ?>">
Output (Screenshot4):-
Screenshot4 |
In Advance php you have to use dynamic forms and so its good example for start-up now in this $text is the variable which is string Hello world. and in html code we had called $text which is string Hello world. its pretty easy. variables also use in database , static text etc. Its very useful in php. variables are declared with ($) sign. and at end use “;”. and when you write php code u can write in one line or multiple line there is same effects. for example
you can use this code also for same result (screenshot4) :-
<?php
$text = 'hello world.';
?>
<input type="text" value="<?php
echo $text;
?>
">
No comments:
Post a Comment
Thanks For Comment Will get you Soon..