0

I have results of people that i need to compare and echo out. Eg 2x dropdown menus with all the peoples names in and each field then echoed in a table once the 2x dropdowns have been selected. the 2x dropdowns will be the same and have the same names in.


Martin Peter
(martin image) (peter image)
field 1 - 56 field 1 - 56
field 2 - 22 field 2 - 22
field 3 - 72 field 3 - 56
field 4 - 75 field 4 - 56


Hope somebody can help as need it for a project.

Edited by mpc123: more info

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by metalix
0

sounds like you need AJAX
view the tutorial at w3schools
I think if you are using them to compare you might want two div tags (one select menu changes one, one changes the other)
for example:

<html>
<head>
<script type="text/javascript">
function showName1(str, div)
{
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(div).innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","gethint.php?q="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>

<h3>Start typing a name in the input field below:</h3>
<form action=""> 
Name:
<select id="txt1" onChange"showName1(this.value, name1)">
<option value="name">name</option>
</select>
Name2:
<select id="txt2" onChange"showName1(this.value, name2)">
<option value="name">name</option>
</select>
</form>
<p>
<span id="name1"></span>
</p> 
<p>
<span id="name2"></span>
</p>

</body>
</html>

obviously I havent checked this for errors but you get the general idea.
your gethint.php will contain the information of each person.

Hope this helps :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.