![]() |
| Output html using echo statement in php |
Code for input data for form (Screenshots1) :-
| Input Data For Form Screenshot1 |
<input type="text" name="name">
output (Screenshot2) :-
| Output 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) :-
| Showing You Parse error |
<?php
echo <input type = "text" name="name">";
?>
output (screenshot4) :- You will find Parse error
| Output 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 example
Code for proper way to write html codes in php echo statement(screenshot5):-
| Writing Html Codes in Php Echo Statement Screenshot5 |
<?php echo "<input type='text' name='name'>"; ?>
output (screenshot2) :-
| Screenshot2 |
There are also different ways to write this codes showing in screenshots for same result screenshot2
| Screenshot6 |
| 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.


