Código HTML:
Ver original
<input type='hidden' name='fecha' value='2010-05-01 12:55:01'>
index.html
Código HTML:
Ver original
<html> <head> <script type="text/javascript"> function showUser(str, fecha) { if (str=="") { document.getElementById("txtHint").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("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","getuser.php?q="+str&fecha="+fecha, true); xmlhttp.send(); } </script> </head> <body> <form> <input type='hidden' name='fecha' value='2010-05-01 12:55:01'> <select name="users" onchange="showUser(this.value)"> </select> </form> <br /> </body> </html>
getuser.php
Código PHP:
Ver original
<?php $q=$_GET["q"]; $fecha=$_GET["fecha"]; if (!$con) { } $sql="SELECT * FROM user WHERE id = '".$q."' and fecha = '".$fecha."' "; echo "<table border='1'> <tr> <th>Firstname</th> <th>Lastname</th> <th>Age</th> <th>Hometown</th> <th>Job</th> </tr>"; { echo "<tr>"; echo "<td>" . $row['FirstName'] . "</td>"; echo "<td>" . $row['LastName'] . "</td>"; echo "<td>" . $row['Age'] . "</td>"; echo "<td>" . $row['Hometown'] . "</td>"; echo "<td>" . $row['Job'] . "</td>"; echo "</tr>"; } echo "</table>"; ?>