here is my objective: I want to be able to click a link that opens a popup window with content pulled from a mysql database.
I cannot figure out how to pass a php variable to a javascript fuction. here is what I have.
<script language="javascript">
//<!--
function popup()
//My problem is on the next line, the ?write_id=$id variable
{ window.open ("content.php?write_id=$id","popup"," width=400,height=400,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=1,toolbar=0") }
-->
</script>
The link looks like this...
echo "<a href=\"javascript:popup()\">$title</a>";
and content.php looks like this...
<?
include("include/dbconnect.php");
$result = mysql_query("SELECT * FROM news WHERE id='$write_id'");
while($r = mysql_fetch_array($result))
{
$content = $r["content"];
echo "<font size=\"2\">$content</font>";
}
?>
==============================
so pretty much I just need to know how to get the php variable $id recognizable in a javascript function (popup)
-h34rt