how do i go about binding data from a mysql database to a dropdownlist? and to read the database?
explain a bit.
Just query the database for the column you want to populate the list/menu with … ie:
<select name="manufacturer">
<?php $sql = mysql_query("SELECT * FROM manufacturer ORDER BY make ASC"); while ($row = mysql_fetch_array($sql)) { ?>
<option <?php echo $_POST['manufacturer']==$row['manufacturer'] ? 'selected' : ''?>><?php echo $row['manufacturer'] ?></option>
<?php } ?>
</select>
=) thanks for that help!
how about from the dropdownlist to be registered into the database?
Then u post the list/menu data to yer script which contains the INSERT sql query … to insert the records from the form posted.
hth
yepyep. i got that one. =))
maybe u could help me with my page redirections? i posted that in another thread.
I think markl999 has solved that issue for u …
thanks much anyways!
is there anyway that i can do this: when a user selects an option from the dropdownlist, it will display the table from where the user selects? not contents from the table… but from the different tables to correspond to the selected option. is that possible?
To do it right, so it all works on the client, you need to get the data from ALL the tables, write them all into arrays on the client in JS, and then they appear to work like magic. Look at some airline site, easyjet, ryannair etc.
Otherwise theres no point in doing it, your page has to go back to the server and get the page, and users on dial up have to …
wait.
Indeed but good things come to those who wait (unless of course you miscode the last line :D) This is really useful though guys, i was going to post this question, but not necessary!
okay… how about i have the information all in one table, and then retrieve the data that has the same clientcode, and displaying them? all selected from the dropdownlist again and even tho it has the same clientcode name, each row will be unique as it has its own program no…
so main point is:
select from dropdownlist, and display information only from the selected item.