naveendk.55 Posted September 12, 2011 Share Posted September 12, 2011 I am trying to access a value (number called userid) from database and display it in Textbox. This user ID should be depending on the name that customer select from a drop down box above the UserId textbox. The NAME that customer select is also from database. Any one help me to write the WHERE statement and put that in textbox. Below is the code that I tried but got stuck. <td> Name </td> <td> <select name="aname" id="aname" style="width: 147px"> <?php $result = mysql_query("SELECT name FROM empdata where role='user' ORDER BY name ASC"); while ($row = mysql_fetch_array($result)) { echo "<option>" . $row['name'] . "</option>"; } ?> </select></td> </tr> <tr> <td> ID </td> <td colspan='3'> <input type="text" name="id" id="id"/> <?php $result = mysql_query("SELECT userid FROM empdata where name= "); ?> </td> Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted September 12, 2011 Share Posted September 12, 2011 couple of things - 1 this screams of "homework assignment" and -2 a table isn't a textbox, so what are you supposed to be using? Quote Link to comment Share on other sites More sharing options...
naveendk.55 Posted September 12, 2011 Author Share Posted September 12, 2011 I have assigned a unique number for each Name in database. I want to display the unique number depending on the name selected in below textbox. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 12, 2011 Share Posted September 12, 2011 Well, you might want to use $result somehow. Quote Link to comment Share on other sites More sharing options...
naveendk.55 Posted September 12, 2011 Author Share Posted September 12, 2011 I don't mind any way getting it done. Please let me know if any of you have any information. It is an urgent task. Thank U. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 12, 2011 Share Posted September 12, 2011 There are no such things are "urgent tasks" on free forums. Are you familiar with mysql_query()? Quote Link to comment Share on other sites More sharing options...
naveendk.55 Posted September 12, 2011 Author Share Posted September 12, 2011 Yes, I'm know about mysql_query(). But not how to access data for this particular issue. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 12, 2011 Share Posted September 12, 2011 You're in the wrong forum. You're asking about how to make another request to the server from a client-side value -- that's what AJAX is all about. Though I suppose if it's a really small list, you can do it all in JS. Quote Link to comment Share on other sites More sharing options...
naveendk.55 Posted September 12, 2011 Author Share Posted September 12, 2011 Thanks 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.