Jump to content

Recommended Posts

I have created a list box writing a code as follows:

 

<select name=\"select_to_edit\">

<option selected>- -Select a Country- -</option>

</select>

 

And I have to variables named $id and $country_name.

 

Now I want to show the values of the $country_name variable in the List Box.

 

Please someone help me to write the code.

Link to comment
https://forums.phpfreaks.com/topic/141774-need-help-to-add-values-in-list-box/
Share on other sites

where are you getting the values from ?  array ... database ... text file ?

 

He did...

 

And I have to variables named $id and $country_name.

 

I'm guessing you want the option to be $country_name and the value that you reference the $id.  Try something like:

 


while ($row = mysql_fetch_array($result)) {  
    echo "<option value="" . $row['id'] . "">" . $row['country_name] . "</option>

 

that is just for the drop down menu i am assuming you have the rest of the php code to pull the values from the database?

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.