fripay 0 Report post Posted August 17, 2009 Can i use PHP varables inside a HTML tag like this? <applet code=<?php echo $link; ?>.class name=<?php echo $link; ?> archive=<?php echo $link; ?>.jar width=300 height=300> <param name="bgcolor" value="ffffff"> <param name="fontcolor" value="000000"> Your browser is not Java enabled. </applet>because it won't load the applet EDIT! I just looked at the source code produced in Mozilla Here is the HTML... <span class="postbody"> </span><html> <head></head> <body> <h2>You chose to play:</h2> Hello World <applet code=HelloWorldApp.class name=HelloWorldApp archive=HelloWorldApp.jar width=300 height=300> <param name="bgcolor" value="ffffff"> <param name="fontcolor" value="000000"> Your browser is not Java enabled. </applet> Click to return to <a href="java.html">Java Applets</a>. </body> </html> The variables seem to work fine Here is my PHP code...<html> <head></head> <body> <?php // get form selection $whichGame = $_GET['whichGame']; // check value and select appropriate item if ($whichGame == 1) { $game = 'Hello World'; $link = 'HelloWorldApp'; } elseif ($whichGame == 2) { $game = 'Game 2'; $link = 'Game2'; } elseif ($whichGame == 3) { $game = 'Game 3'; $link = 'Game3'; } else { $game = 'Game 4'; $link = 'Game4'; } ?> <h2>You chose to play:</h2> <?php echo $game; ?> <applet code=<?php echo $link; ?>.class name=<?php echo $link; ?> archive=<?php echo $link; ?>.jar width=300 height=300> <param name="bgcolor" value="ffffff"> <param name="fontcolor" value="000000"> Your browser is not Java enabled. </applet> Click to return to <a href="java.html">Java Applets</a>. </body> </html> I have the HTML page and the HelloWorldApp.class in the same directory. It might not be a PHP problem, i dunno?!? Can anyone see why the applet won't work? The error message in the applet says it cannot find HelloWorldApp.class Thanks Share this post Link to post Share on other sites
fuzionmusic 0 Report post Posted August 19, 2009 Did u try to load your class file and your jar file in a regular HTML file first. Try that to see fi it works and let us know. im not sure about applets but don't u need "" around your variables <applet code="HelloWorldApp.class" name="HelloWorldApp" archive="HelloWorldApp.jar" width="300 " height="300"> ^^^^^^Like this Share this post Link to post Share on other sites
webishqiptar 0 Report post Posted August 19, 2009 The php code seems to work fine, as you stated from mozilla source code. And the php script is written well, as you can include normally php in html tags( I do this all the time), but I guess there must be something wrong with javascript code or applets, to which I am not very familiar. Although I will give a deeper or closer look. Share this post Link to post Share on other sites