Hi everyone

$i=0;
echo '<script language="javascript">
var dA = new Array();
var x = 0;

for(i=0;i<2;i++)
{

	dA[x++]="'.$date[$i]." ".$message[$i].'";
		'.$i++.';
	
}


</script>';

here i want to increment $i above code is not working, Please help...Thanks in Advance...

You can't execute a client side(javascript) for loop on the server side(php). You can print javascript out incrementally that would be an array of size 2 using a for loop on your server side. For instance:

$i = 0;
echo '<script type=text/javascript>';
echo 'var dA = new Array();';
for ($i = 0; $i < 2; $i++)
{
    echo 'dA['.$i.'] = "'.$date[$i].$message[$i].'";';
}
echo '</script>';
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.