Jump to content

Passing PHP variables


sseeley

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.