title: Pass client-side javascript variable to server-side php
body: <p>I try again to ask my question. I hope that this time it's clear enough.</p>
  
  <p>Here's the live demo of my script:
  <a href="http://www.virusgaming.net/test/" rel="nofollow">http://www.virusgaming.net/test/</a></p>
  
  <p>And this is the code:</p>
  
  <pre><code>&lt;? // I set the starting percentage to 0%. 
  $something = 0; ?&gt;      
  
  &lt;!-- jsProgressBarHandler prerequisites : prototype.js --&gt;
  &lt;script type="text/javascript" src="js/prototype/prototype.js"&gt;&lt;/script&gt;
  
  &lt;!-- jsProgressBarHandler core --&gt;
  &lt;script type="text/javascript" src="js/bramus/jsProgressBarHandler.js"&gt;&lt;/script&gt;        
  
  &lt;span style="color:#006600;font-weight:bold;"&gt;Multi Color Bar&lt;/span&gt; &lt;br/&gt;
  &lt;span id="element6"&gt;Loading...&lt;/span&gt;
  &lt;span class="extra"&gt;&lt;a href="#" onclick="manualPB2.setPercentage('0', true);return false;"&gt;&lt;img src="images/icons/empty.gif" alt="" title="" onmouseout="$('Text6').innerHTML ='&amp;laquo; Select Options'" onmouseover="$('Text6').innerHTML ='Empty Bar'"/&gt;&lt;/a&gt;&lt;/span&gt;
  &lt;span class="options"&gt;&lt;a href="#" onclick="manualPB2.setPercentage('+10');return false;"&gt;&lt;img src="images/icons/add.gif" alt="" title="" onmouseout="$('Text6').innerHTML ='&amp;laquo; Select Options'" onmouseover="$('Text6').innerHTML ='Add 10%'"/&gt;&lt;/a&gt;&lt;/span&gt;
  &lt;span class="options"&gt;&lt;a href="#" onclick="manualPB2.setPercentage('-5');return false;"&gt;&lt;img src="images/icons/minus.gif" alt="" title="" onmouseout="$('Text6').innerHTML ='&amp;laquo; Select Options'" onmouseover="$('Text6').innerHTML ='Minus 5%'" /&gt;&lt;/a&gt;&lt;/span&gt;
  &lt;span class="options"&gt;&lt;a href="#" onclick="manualPB2.setPercentage('30');return false;"&gt;&lt;img src="images/icons/set.gif" alt="" title="" onmouseout="$('Text6').innerHTML ='&amp;laquo; Select Options'" onmouseover="$('Text6').innerHTML ='Set 30%'"/&gt;&lt;/a&gt;&lt;/span&gt;
  &lt;span class="options"&gt;&lt;a href="#" onclick="manualPB2.setPercentage('98'); manualPB2.setPercentage('30'); return false;"&gt;&lt;img src="images/icons/fill.gif" alt="" title="" onmouseout="$('Text6').innerHTML ='&amp;laquo; Select Options'" onmouseover="$('Text6').innerHTML ='Fill 98%, and then 30%'" /&gt;&lt;/a&gt;&lt;/span&gt;
  &lt;span class="getOption"&gt;&lt;a href="#" onclick="alert(manualPB2.getPercentage());return false;"&gt;&lt;img src="images/icons/get.gif" alt="" title="" onmouseout="$('Text6').innerHTML ='&amp;laquo; Select Options'" onmouseover="$('Text6').innerHTML ='Get Current %'"/&gt;&lt;/a&gt;&lt;/span&gt;
  &lt;span id="Text6" style="font-weight:bold"&gt;&amp;laquo; Select Options&lt;/span&gt;
  
  &lt;script type="text/javascript"&gt;                     
      document.observe('dom:loaded', function() {
  
          manualPB2 = new JS_BRAMUS.jsProgressBar(
                      $('element6'),
                      &lt;? echo $something; ?&gt;,                             
                      {
  
                          barImage    : Array(
                              'images/bramus/percentImage_back4.png',
                              'images/bramus/percentImage_back3.png',
                              'images/bramus/percentImage_back2.png',
                              'images/bramus/percentImage_back1.png'
                          ),
  
                          onTick : function(pbObj) {
  
                              switch(pbObj.getPercentage()) {
  
                                  case 70:
                                      alert('we are at 70%');
                                  break;
  
                                  case 100:
                                      alert('we are at 100%');                                        
                                  break;                                                                                                                                                                              
  
                              }
  
                              return true; 
                          }
                      }
                  );
      }, false);
  &lt;/script&gt;
  </code></pre>
  
  <p>I want to pass the client-side javascript percentage to server-side php variable. I did tens of tries with GET and POST javascript (hidden fields, forms, anchor, onclick event etc) with no success. Basically with the <strong>onclick="alert(manualPB2.getPercentage());</strong> function i stamp the current percentage in an alert. Is possible edit this alert so that it post/get the variable to php?</p>