Jump to content

dropdown menu items


funbinod
 Share

Recommended Posts

Easy.

foreach($users as $u){print('<input type="radio" name="username" value="'.$u.'">'.$u.'<br>');}

Drop down is CSS finish off.

Edited by es131245
Link to comment
Share on other sites

  • 3 weeks later...

i created loop for selecting from all the rows of a table

like this---

<?$rows = mysql_num_rows($result);for ($n = 0 ; $n < $rows ; ++$n)	{		echo '' . mysql_result($result,$n,'item') . '<br />';	}?>

but couldn't insert it into a dropdown list. please guide...

Link to comment
Share on other sites

tried to put in dropdown menu like this ----

 

echo '<form action="#" id="test" name="test">';echo '<select name="item">';echo "<option></option>";echo "<option>";{echo '' . mysql_result($result,$n,'item') . '<br />';}echo "</option>";echo '</select>';echo '</form>';

but returned error

 

"Warning: mysql_result(): Unable to jump to row 2 on MySQL result index 5 in .................................."

Link to comment
Share on other sites

This is what I did:

		<label>Client:</label>		<?php			$result = mysqli_query($con,"SELECT * FROM clients");			echo "<select name='clientid'>";			while ($row = mysqli_fetch_array($result)) {				echo "<option value='" . $row['id'] . "'>" . $row['name'] . "</option>";			}			echo "</select>";    ?>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...