Jump to content

Listbox And Its Selection


MoFish

Recommended Posts

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

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....

 

;)

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.