Jump to content

june_c21

Members
  • Posts

    280
  • Joined

  • Last visited

    Never

Everything posted by june_c21

  1. the error is when i click on any list in the pull down menu there is no data come out. what's wrong? <td><select name="tool_list" onChange="showUser(this.value)"> <?php $host = 'localhost'; $user = 'root'; $password = 'admin'; $dbase = 'tool'; $dblink = mysql_connect($host,$user,$password); mysql_select_db($dbase,$dblink); $query = "SELECT title,capacity from tool_list "; $result = mysql_query($query); while($myrow = mysql_fetch_row($result)) { echo "<OPTION VALUE=\"" . $myrow[0] . "\">" . $myrow[0]; } ?> </select></td> var xmlHttp; function showUser(str) { xmlHttp = (window.ActiveXObject)? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="getuser.php" url=url+"?id="+str url=url+"&sid="+Math.random() xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) }function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText } }function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } <?php $id=$_GET["id"]; $host = 'localhost'; $user = 'root'; $password = 'admin'; $dbase = 'tool'; $dblink = mysql_connect($host,$user,$password); mysql_select_db($dbase,$dblink); $sql="SELECT * FROM tool_list WHERE id = '".$id."'"; $result = mysql_query($sql); echo "<table border='1'> <tr> <th>ID</th> <th>Title</th> <th>Model</th> <th>Capacity</th> <th>Quantity</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row[0] . "</td>"; echo "<td>" . $row[1] . "</td>"; echo "<td>" . $row[2] . "</td>"; echo "<td>" . $row[3] . "</td>"; echo "<td>" . $row[4] . "</td>"; echo "</tr>"; } echo "</table>"; ?>
  2. hi, can someone figure out what's wrong with this? on my selection list, it is empty, no data been extract out from the database <td><select name="users" onChange="showUser(this.value)"> <OPTION VALUE="1"> <?php $host = 'localhost'; $user = 'root'; $password = 'admin'; $dbase = 'tool'; $dblink = mysql_connect($host,$user,$password); mysql_select_db($dbase,$dblink); $query = "SELECT title from tool_list "; $result = mysql_query($query); while($myrow = mysql_fetch_row($result)) { echo "<OPTION VALUE=\"" . $myrow[0] . "\">" ; } ?> </select></td>
  3. hi, sorry... i just update my code. can anyone help with the the listing the option value from database? html page <html> <head> <script src="selectuser.js"></script> </head> <body><form> <table width="497" border="0"> <tr> <td width="284">Staff No </td> <td width="203"><input type="text" name="textfield"></td> </tr> <tr> <td>GF</td> <td><input type="text" name="textfield2"></td> </tr> <tr> <td>Designation</td> <td><input type="text" name="textfield3"></td> </tr> <tr> <td>Date Of Borrow </td> <td><input type="text" name="textfield4"></td> </tr> <tr> <td>Tools</td> <td><select name="tool_list" onChange="showUser(this.value)"> <option value="1">Allen Keys (2MM)</option> <option value="2">Allen Keys (2.5MM)</option> <option value="3">Glenn Quagmire</option> <option value="4">Joseph Swanson</option> </select></td> </tr> <tr> <td colspan="2"><p> <div id="txtHint">Info will be listed here.</div> </p> </td> </tr> <tr> <td>Quantity</td> <td><input type="text" name="textfield5"></td> </tr> <tr> <td>Status</td> <td><select name="select"> <option>Borrow</option> </select> </td> </tr> </table> <p> </p> <p> <input type="submit" name="Submit" value="Submit"> </p> </form></body> </html> javascipt var xmlHttp; function showUser(str) { xmlHttp = (window.ActiveXObject)? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="getuser.php" url=url+"?id="+str url=url+"&sid="+Math.random() xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) }function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText } }function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } php <?php $id=$_GET["id"]; $host = 'localhost'; $user = 'root'; $password = 'admin'; $dbase = 'tool'; $dblink = mysql_connect($host,$user,$password); mysql_select_db($dbase,$dblink); $sql="SELECT * FROM tool_list WHERE id = '".$id."'"; $result = mysql_query($sql); echo "<table border='1'> <tr> <th>ID</th> <th>Title</th> <th>Model</th> <th>Capacity</th> <th>Quantity</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row[0] . "</td>"; echo "<td>" . $row[1] . "</td>"; echo "<td>" . $row[2] . "</td>"; echo "<td>" . $row[3] . "</td>"; echo "<td>" . $row[4] . "</td>"; echo "</tr>"; } echo "</table>"; ?>
  4. thanks... another part is how to pull the value from database to put in my pull down menu option so that i don't have to write it out. I got 500++ options.
  5. thanks... another part is how to pull the value from database to put in my pull down menu option so that i don't have to write it out. I got 500++ options.
  6. hi, i try to run this code but when i code on the select menu, there is no information display. can someone tell me what's the mistake? html page <html> <head> <script src="selectuser.js"></script> </head> <body><form> <table width="497" border="0"> <tr> <td width="284">Staff No </td> <td width="203"><input type="text" name="textfield"></td> </tr> <tr> <td>GF</td> <td><input type="text" name="textfield2"></td> </tr> <tr> <td>Designation</td> <td><input type="text" name="textfield3"></td> </tr> <tr> <td>Date Of Borrow </td> <td><input type="text" name="textfield4"></td> </tr> <tr> <td>Tools</td> <td><select name="tool_list" onChange="showUser(this.value)"> <option value="1">Allen Keys (2MM)</option> <option value="2">Allen Keys (2.5MM)</option> <option value="3">Glenn Quagmire</option> <option value="4">Joseph Swanson</option> </select></td> </tr> <tr> <td colspan="2"><p> <div id="txtHint"><b>Info will be listed here.</b></div> </p> </td> </tr> <tr> <td>Quantity</td> <td><input type="text" name="textfield5"></td> </tr> <tr> <td>Status</td> <td><select name="select"> <option>Borrow</option> </select> </td> </tr> </table> <p> </p> <p> <input type="submit" name="Submit" value="Submit"> </p> </form></body> </html> javascript var xmlHttpfunction showUser(str) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="getuser.php" url=url+"?id="+str url=url+"&sid="+Math.random() xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) }function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText } }function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } php code <?php $id=$_GET["id"]; $host = 'localhost'; $user = 'root'; $password = 'admin'; $dbase = 'tool'; $dblink = mysql_connect($host,$user,$password); mysql_select_db($dbase,$dblink); $sql="SELECT * FROM tool_list WHERE id = '".$id."'"; $result = mysql_query($sql); echo "<table border='1'> <tr> <th>ID</th> <th>Title</th> <th>Model</th> <th>Capacity</th> <th>Quantity</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row[0] . "</td>"; echo "<td>" . $row[1] . "</td>"; echo "<td>" . $row[2] . "</td>"; echo "<td>" . $row[3] . "</td>"; echo "<td>" . $row[4] . "</td>"; echo "</tr>"; } echo "</table>"; ?>
  7. june_c21

    Seach

    hi, sorry for this silly question. i want to make a search box and after user enter any keywords it going to display it out together with the link. How to write the code.
  8. june_c21

    help ....

    yes, i try but still unsuccessful.
  9. june_c21

    help ....

    it is on my server not host
  10. june_c21

    help ....

    when i open my localhost/phpmyadmin. it pop up this error : phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in config.inc.php and make sure that they correspond to the information given by the administrator of the MySQL server. i have try to reinstall the mysql server. set with or without password but it still having the same problem. can someone please help me on this? thanks
  11. june_c21

    help ....

    can someone pls help me
  12. june_c21

    help ....

    hi, i think i accidently delete 'root' in phpmyadmin. How to reset back? now i can't access to any database or create new database.
  13. hi, i just made a form for user to enter their information. the staff no will be store using session. how can i take the staff no and reuse in other page? It is using $_Get ?
  14. hi, i would like to create something similar to youtube. when user click on "add to playlist" , it will automatically appear the pull down menu. once user done with clicking their choice in the pulldown menu, it will automatically hide. how to write the code? please help me... i need it for my assignment. thanks
  15. hi, Date Claim 12/12/07 Parking 12/12/07 Tol how to insert these multiple rows of data into database ?
  16. anyone can help me on this?
  17. i read this before but i don't really understand.may b you can explain more
  18. ekloh ,but that one is for pull down menu for title only. what bout after user select title and the model will come out without user refresh it?
  19. hi,i doing a simple program for tool store. i want to make a pull down menu (title) that taken data from database.Once user click on the particular (title), the (model) of it will appear without user refresh it. how to do that?
  20. hi, can someone help me to figure out what's wrong with this code. thanks $query = "SELECT unit FROM report " ; $result = mysql_query($query,$dblink); while($row = mysql_fetch_array($result)) { $unit = $row[0]; } if($unit==GF1) { // echo "this is Role #1" $redirect = 'sort_gf1.php' ; } elseif($unit==2) { $redirect = 'champ.html'; } elseif($unit==3) { $redirect = 'champ.html'; } else { $redirect = 'view1.php'; } header ("Location: $redirect");
  21. ok, i been thinking the same way too but how to link it with mysql?
  22. i don't really understand. i am kind of new and still learning on this. may be you can explain more to me.
×
×
  • 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.