Jump to content

Function


unidox

Recommended Posts

I was wondering how I can do this:

 

I have alot of options inside a select, and I need to have the values like:

 

<option <? if($r['name'] == option value) { echo "selected = selected"; } ?> value = "John">

 

but the problem is, how can I find the value without typing the name in for each option. Thanks

Link to comment
Share on other sites

Ok, I have a dropdown like this:

 

<select name="name">

  <option value="John">

</select>

 

but I have over 400 options from the drop down. I was wondering if there was a way I can make it selected if the user already selected it. Because lets say I add a user, it adds the name John in the db. When I want to edit the user, I dont want to sort through all the names, I am trying to have it selected if the value matches the database.

 

How can I do that? Thanks

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.