vikaspa Posted June 6, 2007 Share Posted June 6, 2007 Dear All find below a code to populate / display a table The values in array are taken from a stream file or test file made using note pad and hence are changing In tthis i had specified subject as subject="abcd" where asd I want this subject as array valu i.e. $array[$i]; How can I do this ...Please help <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="19" colspan="3" valign="top"> </td> </tr> <?php for ($i=0; $i<=$la-1; $i++) { ?> <tr> <td width="8%" align="center"> </td> <td width="19%" height="25" align="center" valign="top"><img src="bluearrow.jpg" width="15" height="11" vspace="2"></td> <td width="73%" height="25" valign="top"><span class="text12b"> <a href="mailto:[email protected]?subject="abcd"><?php echo $array[$i]; ?></a></span></td> </tr> <?php } ?> </table> Link to comment https://forums.phpfreaks.com/topic/54392-pass-php-variable-array-value-to-javasript-variable/ Share on other sites More sharing options...
mainewoods Posted June 7, 2007 Share Posted June 7, 2007 to pass a php variable to a javascript variable, use this template: <script> jsvariable = "<?php echo addslashes($phpvariable); ?>"; </script> notice the quotes in that statement. they are necessary if passing a string variable. if passing a number leave off the quotes and the addslashes(). Link to comment https://forums.phpfreaks.com/topic/54392-pass-php-variable-array-value-to-javasript-variable/#findComment-269633 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.