Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[HTML/CSS] Nulllify radio input when checked

Ball like Wall
Joined
Aug 12, 2009
Messages
301
Reaction score
56
I'm editing a page of mine, and I want to allow users to choose one of the choices, but when they submit it, it's actually the other option no matter what they choose (there's only 2 options).

Any help is appreciated.
 
Joined
May 23, 2008
Messages
1,071
Reaction score
574
Where are they submitting it to?
Do the two options change, or are they always the same two options?

The problem seems simple at face value, so I can only assume there is more to it.
If I were to give a direct answer to you now, I'd say:
Just use an if conditional to swap the option that the user chooses.
PHP:
$option = $_POST['option'];
if ($option == 1) {
  $option = 2;
} elseif ($option == 2) {
  $option = 1;
}
 
Banned
Banned
Joined
Feb 14, 2007
Messages
1,405
Reaction score
220
Please send us Details and screenshots as soon as possible we really want to see more of this.

Thanks.
 
Canadian
Loyal Member
Joined
Dec 4, 2007
Messages
1,936
Reaction score
96
Well he said HTML, not PHP.

Code:
<input type="radio" name="views" value="gay" /> I'm gay
<input type="radio" name="views" value="gay" /> I'm straight

That would give the same value for both choices.
 
☮TAKU????
Loyal Member
Joined
Nov 16, 2009
Messages
866
Reaction score
580
Well he said HTML, not PHP.

Code:
<input type="radio" name="views" value="gay" /> I'm gay
<input type="radio" name="views" value="gay" /> I'm straight

That would give the same value for both choices.

Why is both of your radio values "gay"?

1 should be "gay"
2 should be "straight"
 
Joined
Jul 26, 2006
Messages
3,634
Reaction score
1,007
Well he said HTML, not PHP.

Code:
<input type="radio" name="views" value="gay" /> I'm gay
<input type="radio" name="views" value="gay" /> I'm straight

That would give the same value for both choices.

I think he doesn't necessarily want to restrict input to just "gay", but he wants the actual choice to be the opposite of the selection, like so (from what I understand):
Code:
<input type="radio" name="views" value="gay" /> I'm straight
<input type="radio" name="views" value="straight" /> I'm gay
 
Canadian
Loyal Member
Joined
Dec 4, 2007
Messages
1,936
Reaction score
96
Why is both of your radio values "gay"?

1 should be "gay"
2 should be "straight"

From his question I assumed he wanted no matter what you picked, it selected 1 option. So if you picked gay, it went with gay, if you picked straight, it went with gay.
 
Back
Top