I’m looking for a function like and if else statement for php which will execute certain html code.
For example:
<?php>
$result = 1;
if ($result == 1)
<?>
html code
else
html code
So, based off the result variable gotten from php scripts, a certain html page is output. I’ve tried echoing the entire html page, but it just displays the html code-> tags and such.
Hopefully you get what I’m trying to get across, ask if you need any clarification questions. Thanks!
This is not entirely true. You can use the approach below:
Or, if you don’t want to exit PHP coding, you can use the
echoorprintstatements. Example:Just be careful with proper sequences of
'and"characters. If your HTML tags are to have arguments, you should watch your step and use either of the following approaches: