PDA

Click to See Complete Forum and Search --> : PHP/Javascript Wierd combination - variable trouble


BIOSTALL
Jul 27th, 2005, 05:15 PM
Hey... I'm having to mix PHP and Javascript but its turning out to be very complicated for me. I have written a code snippet and i was wondering whether someone would mind telling me if it will work?? I'm asking you before uploading it as i want to know whether i'm going about my problem the right way or not?!?

Here it is:
if ($_SERVER['HTTP_REFERER']=="http://www.scarredforlife.co.uk/ForumReplies?threadid=$threadid&sectionid=$sectid") {
echo "<script>";
echo "var message = document.form1.replymessage.value;";
echo "document.writeln('<?php $_SESSION[message]=' + message + '?>'";
echo "</script>";
}
As you can see, i'm having to enclose javascript within PHP and then PHP withing this javascript. Can this be done??

Many thanks, BIOSTALL

nkad
Jul 27th, 2005, 07:46 PM
This looks to be a problem:<?php $_SESSION[message]=' + message + '?>

Did you already save data in a session? What are you trying to accomplish?