Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have one input (type radio) that I want to insert it 2 values, something like that:

<input type="radio" name="name" value1="value1" value2="value2" />

And after draw each value seperated with PHP.

There is a way to do it? (And no.. I dont want to insert input with type="hidden")

Thank you.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
238 views
Welcome To Ask or Share your Answers For Others

1 Answer

Well, not the way I would do it, but you could use a delimiter for your value(s)

<input type="radio" value="Value1|Value2" name="two_values" />

Then, in PHP, just list($value1,$value2) = explode('|', $_POST['two_values']);

EDIT
As @user387302 said, you would obviously be limited to not having any values containing your delimiter, for example value="One|PipedVariable|andAnother" would not work to extract two values of "One|PipedValue" and "andAnother"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...