Forum Moderators: coopster

Message Too Old, No Replies

how to pull only 1 instance from a row

         

abliss26

9:39 pm on Apr 25, 2006 (gmt 0)

10+ Year Member



I'm pretty new to php, but have a pretty good grasp on things (I think :) ; here's my problem; I would like to populate a combo box based off of values from a table; for example, I have 2 rows in a table, server_name, and session_id; I would like my session_id combo box to fill in based upon a value selected from server_name; the server_name combo box values are hard coded (since I know the names of the servers) ; for example, when a user choose a servername, the combox box is "automaitcally" filled in by querying the database with a list of available session_id's to choose from; any help would be much appreciated

JohnCanyon

10:58 pm on Apr 25, 2006 (gmt 0)

10+ Year Member



sounds like you want something like..

$sql = mysql_query("SELECT session_id FROM your_table WHERE server_name='". mysql_escape_string($_POST[combobox_servername]) ."'");

hakre

11:32 am on Apr 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi abliss26,

does "automatically" mean at once, without pressing a button? if so, you'll end up in the need of some javascript.

anyway, there are some solutions alredy within the forum, maybe this Dynamically add and remove rows that include PHP code [webmasterworld.com]-post helps?