hi i have a array defined in javascript.
how can i use the array in php.
i tried the following but it isn't working.
contactcid[i] is the javascript array.
<?php
echo "<script language=\"javascript\">\n";
echo "$y = 'http://apis.live.net/V4.1/cid-'".contactcid[i]+."'/Photos/Albums\'";
$html = file_get_html($y);
// haal de url op en zet het in $html
// zoek alle img tags op de url in $html en zet ze in $element
foreach($html->find('img') as $w)
{
// en zet ze in beeld
echo "<img src='".$w->src."' width='75' height='75' /><br/>";
}
?>
You can't. JavaScript runs when the code reaches the browser, PHP well before that. What you can do is define the array in PHP, use PHP to output it to JavaScript, and then you'll have free use of the array in both.
Great wit and madness are near allied, and fine a line their bounds divide.
Bookmarks