I'm new on PHP and I want to know if it's possible to write PHP code that's inside HTML, which the last one is inside PHP.
For example in the following code:
$bodyHtml = '
<div class="container">
<img src="' . $bodyBackground . '" class="imgBg"/>
<form method="POST" action="mapa-cardio.php" style="top:150px">
<input type="text" name="name" value="'. $name . '" class="transparent-input font-size-name" style="top: 181px;left: 54px;width: 294px;height: 28px;">
<input type="text" name="data1" value="'. $data1 . '" class="transparent-input font-size-name" maxlength="2" style="top: 181px;left: 468px;width: 19px;height: 28px;">
<input type="text" name="data2" value="'. $data2 . '" class="transparent-input font-size-name" maxlength="2" style="top: 181px;left: 494px;width: 19px;height: 28px;">
<input type="text" name="data3" value="'. $data3 . '" class="transparent-input font-size-name" maxlength="4" style="top: 181px;left: 521px;width: 33px;height: 28px;">
<!-- DADOS ANTROPOMÉTRICOS -->
<input type="text" name="altura" value="'. $altura . '" class="font-size" style="top: 243px;left: 26px;width: 26px;height: 10px;">
<input type="text" name="peso" value="'. $peso . '" class="font-size" style="top: 267px;left: 26px;width: 26px;height: 10px;">
<input type="text" name="perimetroAbdominal" value="'. $perimetroAbdominal . '" class="font-size" style="top: 291px;left: 26px;width: 26px;height: 10px;">
<!-- HÁBITOS -->
'if( isset($_POST['tabagismo']) ) {
$bodyHtml .= '<img src="' . $checkImage . '" class="check" style="top: 181px;left: 54px;width: 15px;height: 15px;">';
}'
I want to add that php if line to that HTML that's concatenated inside PHP variable, is it possible? I get the following error: PHP Parse error: syntax error, unexpected 'if' (T_IF)
Any help/advices will be greatly appreciated.