Tuesday, 15 October 2013

Output html using echo statement in php

Output html using echo statement in php
Output html using echo statement inphp Programming Languages. This is a tutorial i am going to show you how to echo html active page. so, we know how to echo output and now if we want to echo out some html data. Let i want to echo output input text for a form and it will be done outside php code lets see example.
Code for input data for form (Screenshots1) :-
Output html using echo statement in php
Output html using echo statement(Screenshot1)
1
<input type="text" name="name">
output (Screenshot2) :-
Output html using echo statement in php
Output html using echo statement(Screenshot2)
In example in this way we normally write html with php codes.But what if we want to write echo output result which we writes in text box. That text box code will be inside php codes lets see example.
Code for showing you Parse error (screenshot3) :-
Output html using echo statement in php
Output html using echo statement(Screenshot3)
1
2
3
4
5
<?php
 
echo <input type = "text" name="name">";
 
?>
output (screenshot4) :- You will find Parse error
Output html using echo statement in php
Output html using echo statement(Screenshot4)
Parse error: parse error,expecting “;” or “;” in C:\xampp\htdocs\series\echohtml\index.php on line 2. you will see this error because when we starts semi colon with less then greater sign after equal to sign its says its ends here so its expecting “;” there for that there are some standard resolution lets see exmaple
Code for proper way to write html codes in php echo statement(screenshot5):-
Output html using echo statement in php
Output html using echo statement(Screenshot5)
1
2
3
<?php
echo "<input type='text' name='name'>";
?>
output (screenshot2) :-
Output html using echo statement in php
Output html using echo statement(Screenshot2)
There are also different ways to write this codes showing in screenshots for same result screenshot2
Output html using echo statement in php
Output html using echo statement(Screenshot6)
Output html using echo statement in php
Output html using echo statement(Screenshot7)
Screenshot6 and screenshot7 is the other ways to write for same result for screenshot2 well screenshot7 codes are slower then other ways of codes.
Read More Extra Tutorials

No comments:

Post a Comment