Jump to content

AJAX Help?


lalnfl

Recommended Posts

This is what happens . What am I doing wrong? Here is an image of what it is turning out like, and this shouldn't happen.

ss25-1.jpg

 

if (isset ($_GET['add_match'])){

$match_id = $_GET['add_match'];

$sql_match_details = mysql_query("SELECT * FROM Matches WHERE id='$match_id'");
while ($get_match = mysql_fetch_array($sql_match_details)){

$match_name = $get_match['name'];
$match_prestige = $get_match['prestige'];
$match_content_risk = $get_match['content_risk'];
$match_injury_risk = $get_match['injury_risk'];
$match_description = $get_match['description'];

$result = "$match_name";

}

$body = "<div style='width: 300px; float: left'>

<p class='text3' style='font-weight: bold;'>Select Match Type</p>

<form action='promotions.php?promotion_id=$promotion_id&show_id=$show_id&add_match' method='post'>

	<p class='text3'>
<select class='text4' size='20' name='match_type' onchange='showUser(this.value)'>

<option value='1'>1 vs 1</option>

</select></p>

</form>

</div>

</div>

<div style='width: 362px; float: left'>

<div id='result'>
$result
</div>

<div class='line'></div>";

}

 

 

<script type="text/javascript">
function showUser(str)
{
if (str=="")
  {
  document.getElementById("result").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("result").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","promotions.php?promotion_id=$promotion_id&show_id=$show_id&add_match="+str,true);
xmlhttp.send();
}
</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.