Jump to content

list/menu values from database


I-AM-OBODO

Recommended Posts

Hi all,

i want my list/menu field values to come from my database. how can i accomplish that?

thanks

 

i did

<select name="select">
                  <option value="0">--select below--</option>
			  <option value="1">Me</option>
			  <?php
			  
                  require_once '../konnect/konex.php';

			$result = mysql_query("SELECT * FROM is_clients");

			while($row = mysql_fetch_array($result))
			  {
			  echo "<option value ='2'>".$row"['name']</option>";
			  echo "<br />";
			  }

					?>
                  </select>

Link to comment
https://forums.phpfreaks.com/topic/261345-listmenu-values-from-database/
Share on other sites

echo "<option value ='2'>".$row"['name']</option>";

 

1) You've got a mis-placed double-quote in there

2) You're missing a concatenation operator

3) Having the same "value" for all of them will not be very helpful

 

echo "<option value ='" . $row['id'] . "'>" . $row['name'] . "</option>";

echo "<option value ='2'>".$row"['name']</option>";

 

1) You've got a mis-placed double-quote in there

2) You're missing a concatenation operator

3) Having the same "value" for all of them will not be very helpful

 

echo "<option value ='" . $row['id'] . "'>" . $row['name'] . "</option>";

 

thanks. gat it now

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.