Hi currently working on a page to get a form corresponding to my database.
I want that the good option 'TYPE' gets selected corresponding to $client['CLT_type']
Here how my actual code looks (and what I tested) But I get this error :
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in 24
24 is my $select line
if($client = $requeteClt->fetch()) {
$select = "<?php if($client['CLT_type']==2) echo 'selected'; ?>";
$page->appendContent(<<<HTML
<div id='res' height='800px'></div>
<form id='form' name='form' method='POST' action='modifierClientScript.php' style='width:100%;'>
<h2 style="text-align:center;">Modification du client {$client['CLT_libelle']}</h2>
<p>
<label for='montant'>Nom :</label>
<input type='text' value='{$client['CLT_libelle']}' name='nom' id='nom'>
<span class="error" id="nomErr"></span>
</p>
<p>
<label for='type'>Segmentation Client :</label>
<SELECT name='type' id='type'>
<optgroup label="Publics">
<OPTION value='1'>Etat
<OPTION value='2' {$select}>Collectivité
<OPTION value='3'>Entreprise publique
<optgroup label="Privés">
<OPTION value='4'>Entreprise de service
<OPTION value='5'>Entreprise industrielle
<OPTION value='6'>Autres
</SELECT>
</p><br/>
<p><br/>
<input type='button' name='submit' id='submit' value='Modifier le client'>
</p>
</form>
HTML
);
So is it possible to add PHP code in the Heredoc or do I have to manage my page by another way ? Thx