Echo PHP variable from JavaScript?

shao190

New Member
I have a PHP page with some JavaScript code also, but this JavaScript code below doesn't seem to work, or maybe I'm way off!I am trying something like this:\[code\] var areaOption=document.getElementById("<?php echo @$_POST['annonsera_name']?>"); areaOption.selected=true;\[/code\]Also I have tried this, but it only alerts a BLANK alert-box:\[code\] alert (<?php echo $test;?>); // I have tried this with quotes, double-quotes, etc... no luck\[/code\]Am I thinking completely wrong here?UPDATESome PHP code:\[code\] <?php $test = "Hello World!"; ?>\[/code\]
 
Back
Top