I have recently asked this question, but rather than getting a direct answer, I was shown how to use the ternary operator to simplify my code by substituting if statements inside my html with variables, which I appreciated and put to use - however that also caused other code to be harder to read and ultimately did not teach me to properly escape/parse php in code similar to that below.
So I would love a simple 'show and tell' of how to make the following code parse, thank you:
<?php
if (!isset($_POST['myform'])) {
echo
<form method="POST" action="<?php if (isset($myform_worked)) { echo 'somepath'; } ?>" accept-charset="UTF-8">
This is what I've tried, but the line above doesn't parse:
<?php
if (!isset($_POST['myform'])) {
echo
'<form method="POST" action="'<?php if (isset($myform_worked)) { echo 'somepath'; } ?>'" accept-charset="UTF-8">'
I have also tried (using double quotes around the php inside :
"<?php if (isset($myform_worked)) { echo 'somepath'; } ?>"
Please show this nub how to do this, thanks. I do not care if the above code is BAD... I just need to learn how to escape/parse php inside html inside php, thanks.