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:
Code:
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