Jump to content
xisto Community
Sign in to follow this  
fripay

Html Tags? HTML tags?

Recommended Posts

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

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.