Reputation: 3
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?
Upvotes: 0
Views: 756
Reputation: 168845
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.)
Upvotes: 1