Last active
December 20, 2015 01:39
-
-
Save WenLiangTseng/6050566 to your computer and use it in GitHub Desktop.
讓HTML的一個Option取多個數值
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- put values for each options like --> | |
<SELECT NAME="val"> | |
<OPTION VALUE="1" value="1:2:3:4"> 1-4 | |
<OPTION VALUE="2" value="5:6:7:8"> 5-8 | |
<OPTION VALUE="3" value="9:10:11:12"> 9-12 | |
</SELECT> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//at server side in case of php, use functions like | |
//explode [array] = explode([delimeter],[posted value]); | |
$values = explode(':',$_POST['val']); | |
$values[0]; | |
$values[1]; | |
//etc. | |
//the above code return an array have only the numbers | |
//and the ':' get removed | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment