2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

Follow the sample to know how to pass php variable to javascript:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>Pass PHP value to JAVASCRIPT</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="language" content="en" />
	<meta name="description" content="" />
	<meta name="keywords" content="" />
</head>
<body bgcolor='#f1f1f1' text='#000000' link='#33cc00' alink='#33cc00' vlink='#33cc00'>
	<?php
		for($i=0; $i<20; $i++)
	{?>
	<script type = 'text/javascript'>
		var hp="<?php echo $i; ?>";
		alert (hp);
		</script>
	<?php
	}
	?>
</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.