I would like to output javascript value in a php code. It seems easy but the javascript variables must be based on the answers of a form of the document.
For exemple : If first radio button is checked, outputs first value in php code If second radio button is checked, output second value in php code.
<div class="test">
<div>
<input type="radio" id="troismois"
name="testradio" value="troismois" checked />
<label for="troismois">3 mois</label>
</div>
<div>
<input type="radio" id="unmois"
name="testradio" value="unmois" />
<label for="unmois">1 mois</label>
</div>
<script>
var checkBox = document.getElementById("huey");
if (checkBox.checked == true){
var x = "10";
} else {
var x = "20";
}
</script>
<?php
$content = "<script> document.write(x) </script>";
echo $content;
?>
But it's working, I miss something but I don't know what, maybe someone can help me?
Thank you !
Aucun commentaire:
Enregistrer un commentaire