1

I'd like to send some parameters from HTML to Java Applet, but I want to set them first in HTML.

Can you help me? I tried:

<HTML>
<BODY>

<?php
$a=rand(0,10);
$b=rand(0,10);  

echo $a,' ',$b;
?>

<P>
<APPLET ARCHIVE="jfreechart-0.9.21.jar,jcommon-0.9.7.jar" code="PoziomWody.class"    width=350 height=280>
<PARAM NAME=S1 VALUE="$a">
<PARAM NAME=S2 VALUE="$b">

</APPLET>
</P>
</BODY>
</HTML>

However, I got the literal string $a, not the value of the variable.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • [see this][1] [1]: http://stackoverflow.com/questions/12585022/how-to-pass-values-from-html-page-to-java-applet may be you expect this – subash Nov 07 '13 at 13:49
  • HTML is a markup language, not a programming language. HTML has no concept of declaring variables. Are you using PHP or so and confusing it to be part of HTML while it's in essence a HTML code producer? You should tell which server side view technology you're using (e.g. PHP, or JSP, or Facelets, or ASP, etc). Then we can tell how to let them generate HTML output that way that the `` element gets the right value (by the way ... uppercased HTML element/attribute names are soo 1990; are you sure you're reading up-to-date resources while learning the matters?) – BalusC Nov 07 '13 at 14:26
  • 1
    Okay, you're thus using PHP. What makes you think that writing `$a` in HTML template would let PHP magically discover and print the variable's value? Wouldn't it make sense to explicitly let PHP echo the variable right there? – BalusC Nov 07 '13 at 20:05
  • Unrelatedly, you may want to consider using a Javascript library like [Flot](http://www.flotcharts.org/) for charts instead of a Java applet. –  Nov 07 '13 at 20:20

1 Answers1

0

To get the value of the variable at the specified point do this:

<PARAM NAME=S1 VALUE="<?php echo $a; ?>">
<PARAM NAME=S2 VALUE="<?php echo $b; ?>">

Cheers,
Florian

Florian Loch
  • 809
  • 7
  • 12