By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

getting php value to javascript

ditditsasa
P: 17
Expand|Select|Wrap|Line Numbers
  1. while (false !== ($sfname = readdir($dh))) {
  2.   if (substr($sfname, 0, 1) == '.') continue;
  3.   if ($sfname == 'CVS'            ) continue;
  4.   $sitedir = "$OE_SITES_BASE/$sfname";
  5.   if (!is_dir($sitedir)               ) continue;
  6.   if (!is_file("$sitedir/sqlconf.php")) continue;
  7.   $siteslist[$sfname] = $sfname;
  8.   //echo $sfname;
  9. }
hi friends i want to print the sfname value to javascript please help me
Apr 12 '12 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,366
The same way you would output something as HTML.
Apr 12 '12 #2

P: 93
print value in hidden elements like this ::

Expand|Select|Wrap|Line Numbers
  1. $tmp = 0;
  2. while(......)
  3. {
  4.  
  5.          echo "<input type='hidden' id='h_".$tmp."' value='".."'>";
  6.  
  7.         $tmp++;
  8. }
  9.  
after that get that values in javascript like this :::

var t1 = document.getElementById("h_0").value;
var t2 = document.getElementById("h_1").value;

try it.....

Bharat Parmar(Bharat383)
Apr 14 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.