I am trying to pass a javascript variable to php, but on the new page I got only "Array". Where did I go wrong?
<script>
new_window.document.write("<title>".concat(x,"</title>","<?PHP
$rst = mysql_connect("127.0.0.1","root","12345");
$a =$_SERVER['PHP_SELF'];
preg_match_all('/<title>(.*?)<\/title>/',$a, $match);
$script = $match[0];
echo $script;
echo "<br />";
if (!$rst){
echo( "<p>Unable to connect to database manager.</p>");
die('Could not connect: ' . mysql_error());
}
mysql_select_db("oprema", $rst);
$result = mysql_query("SELECT * FROM oprema WHERE mreznomesto='$script'");
while($row = mysql_fetch_array($result)) {
print( $row['mreznomesto'] . " " . $row['serijskibroj']);
echo "<br />";
}
?>"));
</script>
On first page, i've got image map with areas. Onmouseover javascript read area names and send it to javascript generated page. On generated page area name need to be query variable (depending of them show data from database). If i put string instead of variable,everything works fine, result is ok. Only problem is (i think) get variable from html to php on same page.
<script>
tag – experimentX Feb 20 '11 at 10:46