MoFish Posted April 16, 2007 Share Posted April 16, 2007 hello everyone. im trying to create a webpage using mysql and php. im using the below code to populate a listbox with playernames held in my database. once i select a name; im trying to make the page gather the relevant information from that users details to be displayed on the same page. for example if i select "MoFish" from the listbox, i want it to echo all MoFish's details in the page such as his: "age" "height" "weight" if i select "Berty" i want it to echo bertys details. how can i acheive this? thanks alot; mofish <select name="PlayerName1"> <?php do { ?> <option value="<?php echo $row_Select['PLAYERNAME']?>"><?php echo $row_Select['PLAYERNAME']?></option> <?php } while ($row_Select = mysql_fetch_assoc($Select)); $rows = mysql_num_rows($Select); if($rows > 0) { mysql_data_seek($Select, 0); $row_Select = mysql_fetch_assoc($Select); } ?> </select> </td> Link to comment https://forums.phpfreaks.com/topic/47301-listbox-and-its-selection/ Share on other sites More sharing options...
anthylon Posted April 17, 2007 Share Posted April 17, 2007 Make form with list box. So when user select one of items from combo list form will be posted. If your action parameter of form is for example page2.php, than in that file write some code like: $selected_value = $_POST['select_name'] . Than you can make other thinkgs you want. If you want to handle selection without submiting form than you must use JavaScript. But.... Link to comment https://forums.phpfreaks.com/topic/47301-listbox-and-its-selection/#findComment-230854 Share on other sites More sharing options...
MoFish Posted April 17, 2007 Author Share Posted April 17, 2007 thank you, i will give that a go, sounds alot easyer than i first expected. out of curiosity, is the selection without submitting a form complex within javascript? or is it just a couple lines of code like the above. Link to comment https://forums.phpfreaks.com/topic/47301-listbox-and-its-selection/#findComment-230907 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.