/    Sign up×
Community /Pin to ProfileBookmark

I am working in php. i have script.

<select name=’player[$player_id]’>
<option value=’0′ SELECTED></option>”;
foreach ($a as $rowas)
{
echo “<option value='” . $rowas[‘id’] . “‘”; if ($zaidejas_id == $rowas[‘id’]) print “SELECTED”; echo”>” . $rowas[‘name’] . ” ” . $rowas[‘surname’] . “</option>”;
}
echo”</select>

it’s print many.
<select name=’player[1]’>
<option value=’0′ SELECTED></option>”;
<option value=’1′>gar garin</option>
<option value=’2′>Kavi garnet</option>
</select>

<select name=’player[2]’>
<option value=’0′ SELECTED></option>”;
<option value=’1′>gar garin</option>
<option value=’2′>Kavi garnet</option>
</select>

<select name=’player[13]’>
<option value=’0′ SELECTED></option>”;
<option value=’1′>gar garin</option>
<option value=’2′>Kavi garnet</option>
</select>

and etc. i want what if select in one selection option ex. “gar garin” if in others selections disable this name

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliFeb 06.2005 — you can probably remove the one that has been selected

[code=php]
/**
*@param index option element that needs to be removed from other select boxes.
*@param listBox Reference to te actual select element.
*/
function RemoveFromOtherListBoxes(index,listBox){
var frm = document.getElementById("form1");
for(x=0;x<frm.length;x++){
if(frm[x].type=="select-one" && frm[x]!=listBox){
frm[x].options[parseInt(index)] = null;
}
}
}
[/code]


However in my opinion you will have to create some rules around it, since this will be a bit of complex logic.

The method above will et u started yo will need to fine tune it with better logic.
×

Success!

Help @forever_xxl spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...