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?

4

1 回答 1

1

该文件是一个 html 文件。它应该是一个php文件吗?

是的。PHP 结构不在 HTML 中评估,只是按原样转储。


(除非你有一些服务器端的聪明才智为 PHP 提供 HTML 扩展。)

于 2012-01-06T14:59:21.450 回答