Problème avec les côtes (") et (')

Résolu
djimson Messages postés 217 Statut Membre -  
Dalida Messages postés 7114 Date d'inscription   Statut Contributeur Dernière intervention   -
Bonjour,
J'ai un problème avec les one cote et double cote.
Le probl_me se situ sur la ligne en gras. Quelqu'un peut m'expliqué? J'essai en vain mais helas. La signe en gras fait appel a un popup.
Le voici :
<php
echo"<table border=2>
<tr>
<td width=15%>".$resultat['date_annonce']."</td>
<td width=35%>".$resultat['recruteur']."</td>
<td width=30%> <a href=\"emplois.php?id=$resultat[id]\" onclick=\"window.open('emplois.php?id=$resultat[id]','wclose','width=600,height=700,toolbar=no,status=no,left=20,top=30,resizable=no'); return false;\">" .$resultat['poste'].'</a>'"
<td width=20%>".$resultat['lieu']."</td>
</tr>
</table>";
?>

Merci d'avance
Configuration: Windows XP
Firefox 3.0.11

1 réponse

  1. Dalida Messages postés 7114 Date d'inscription   Statut Contributeur Dernière intervention   923
     
    salut,

    pour utiliser un tableau entre les guillemets il faut l'encadrer avec des accolades :
    <?php
    echo"<table border=2>
    <tr>
    <td width=15%>".$resultat['date_annonce']."</td>
    <td width=35%>".$resultat['recruteur']."</td>
    <td width=30%> <a href=\"emplois.php?id={$resultat['id']}\" onclick=\"window.open('emplois.php?id={$resultat['id']}','wclose','width=600,height=700,toolbar=no,status=no,left=20,top=30,resizable=no'); return false;\">" .$resultat['poste'].'</a>'"
    <td width=20%>".$resultat['lieu']."</td>
    </tr>
    </table>";
    ?>

    ou tu fais tout avec des apostrophes :
    <?php
    echo'<table border=2>
    <tr>
    <td width=15%>'.$resultat['date_annonce'].'</td>
    <td width=35%>'.$resultat['recruteur'].'</td>
    <td width=30%> <a href="emplois.php?id='.$resultat['id'].'" onclick="window.open(\'emplois.php?id='.$resultat['id'].'\',\'wclose\',\'width=600,height=700,toolbar=no,status=no,left=20,top=30,resizable=no\'); return false;">'.$resultat['poste'].'</a>
    <td width=20%>'.$resultat['lieu'].'</td>
    </tr>
    </table>';
    ?>

    + https://www.php.net/manual/fr/language.types.string.php#language.types.string.syntax.double

    + https://www.php.net/manual/fr/language.types.string.php#language.types.string.parsing
    0