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
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>";

Link to comment
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>";

 

thanks. gat it now

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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