adzie Posted November 16, 2008 Share Posted November 16, 2008 Hello guys, My script currently finds all users from my DB, once its done this i'd like to be able to click a button and more information appear below that users number and name. First it searchs and for each result shows a row containing the number and name and a click box. When I click the box it should show the details script, but currently no matter which row I click it always shows the details for the very first rows number and always displays this below the first user. any thoughts, ideas, suggestions? many thanks print "<tr> print "<td>$num</td>"; print "<td>$name<td>"; print "<td> <form> <input type=text id=num value='$num'> <input type=button onclick=ajaxFunction() value=Query MySQL /> </form> </td>"; print "<td>"; print "<div id=ajaxDiv>Your result will display here</div>"; print "</tr>"; <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('ajaxDiv'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var pilot_num = document.getElementById(num').value; var queryString = "?num=" + num; ajaxRequest.open("GET", "details.php" + queryString, true); ajaxRequest.send(null); } //--> </script> Quote Link to comment Share on other sites More sharing options...
xtopolis Posted November 16, 2008 Share Posted November 16, 2008 It's hard to tell with what you posted.. You could send all the details from the get go, making that part hidden with a toggle link to show/hide it, per user. Otherwise, we'd probably need to see the php loop that's display all the data for the users being queried. 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.