0

I want to use a php session variable as a parameter when I call a java applet. I have seen answers to this on the net but they do not work on my machine. The html file and applet produce the literal string instead of the content of the variable.

Here is the code that I have used.

<param name="param1" value="<?php echo $thevar;?>" />

I have also tried variations on this to no avail

<?php echo'<param name="param1" value="$thevar" />';?>
<param name="param1" value="<?php echo($thevar);?>" />
<param name="param1" value=<?php echo $thevar;?>/>
<?php echo '<param name="param1" value=".$name1.">';?>
echo '<PARAM NAME="name" VALUE="'
. htmlspecialchars($name1, ENT_QUOTES)
. '">';

The file is an html file. Should it be a php file? I created a php file with the same code, but my machine did not know which program to use to run it. It did not run in firefox.

I start the session prior to having any html.

Some sites recommend that the HTML param tag end with /> and others end it with >, which is correct?

Do I need to escape some characters with the backslash?

1 Answer 1

1

The file is an html file. Should it be a php file?

Yes. PHP structures are not evaluated in HTML, just dumped as-is.


(Unless you have some server-side cleverness that serves PHPs with an HTML extension.)

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. The php file worked. (It would of course not run on my machine, but worked on the server.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.