Envoyer un code html via un formulaire
Bonjour,
J'ai vraiment besoin de votre aide.
Voilà mon problème :
Via un formulaire, j'essaie de passer comme valeur un code html en hidden.
Mais malgré l'utilisation d'un $_POST, je ne récupère pas son contenu.
Dans page1.php , on a un formulaire comme ce qui suit :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
<?php
// instructions...
$html ='<h2>I) Titre1 : </h2>
<div id="partie1">C\'est la 1ère partie.</div>
<h2>II) Titre2 : </h2>
<div id="partie2">C\'est la 2ème partie.</div>
<h2>III) Titre3 : </h2>
<div id="partie3">C\'est la 3ème partie.</div>';
echo $html; //Affichage de $html sur page2.php doit etre exactement comme ceci sur page1.php
echo "<form method=\"post\" accept=\"text/html\" action=\"page2.php\" >
<input type=\"hidden\" name=\"code\" value=".$html." >
<input type=\"submit\" value=\"Afficher\" >
</form>";
// instructions...
?> |
Dans page2.php, on a :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
<?php
// instructions...
if (isset($_POST['code']) ){
$html = $_POST['code'];
echo $html; // il me donne comme résultat : I)
// instructions...
} |
Votre aide me sera énormément apréciable. Merci