sseeley Posted July 3, 2010 Share Posted July 3, 2010 I am trying to pass a PHP variable after the variable has loaded in PHP but nothing is coming through in the alert I have created to test. If anyone can help I would be grateful. $drawIdR2 = mysql_result($getEntriesRd2,$v,"tblteamevents.fkDrawId"); $teamNameR2 = mysql_result($getEntriesRd2,$v,"tblcompleteddraw.teamName"); echo "<tr>"; echo "<td align=\"left\" valign = 'top' width = '100' height = '20' style=\"font-family:arial; font-weight:normal; font-stretch:wider; font-size:14px; color:Black;\">"; if($i > $numberBys) { ?> <head> <script language="JavaScript"> <!-- function myFunction() { var alert1 = "<?php echo $teamNameR2; ?>"; alert("123"); } //--> </script> </head> <?php $drawIdR1 = mysql_result($getEntriesRd1,$xi,"tblteamevents.fkDrawId"); echo "<a href = 'javascript:myFunction()' style=\"A:link;color:Purple\">"; //echo "<a href = 'updateElimination.php?eventId=$eventId&ageGroup=$ageGroupId&round=1&drawId=$drawIdR1' style=\"A:link;color:Purple\">"; echo $teamNameR1 = mysql_result($getEntriesRd1,$xi,"tblcompleteddraw.teamName"); echo "</a>"; $xi++; Thanks for any help that anyone can help. Quote Link to comment Share on other sites More sharing options...
haku Posted July 4, 2010 Share Posted July 4, 2010 That script is going to output multiple head tags. This will cause invalid HTML, and may very well cause your javascript to fail. Anyways, PHP is really irrelevant to javascript. Look at your HTML output for your problems, not at your PHP script. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.