I am trying to create something where a user may select various options and be taken to a page based on the selected options. However, the users must be able to come to the unique page using a short URL in the future.
Example of what I am trying to do:
[ ] 1st val
[x] 2nd val
[x] 3rd val
[x] 4th val
[ ] 5th val
Stored in database as: ID = 123DF3 VAL = 2,3,4
User visits: http://website.com/123DF3/
Gets page: You have selected 2, 3 & 4.
Is there a way to do this without having to store every possible combination of the option values in a database (wasteful and inefficient)?
Example:
ID = 123DF3 VAL = 2,3,4
ID = 223FR5 VAL = 2,4,3
ID = 323FG4 VAL = 4,3,2
ID = 253FR7 VAL = 4,2,3
ID = 623GR6 VAL = 3,4,2
ID = 724FR8 VAL = 3,2,4
etc... with increasing possibilities as the amount of values increase.
The alternative is to have every variable in a URL, but it makes the URL very long if there are a lot if values (Eg. http://website.com?v=1,2,3,4,5,6...).
I want to try to avoid this method if possible, but will have to resort to it if I can not come up with a creative way to overcome the above issue.
Sample Input:
array(40) { [0]=> string(1) "1" [1]=> string(1) "2" [2]=> string(2) "40" [3]=> string(1) "3" [4]=> string(1) "4" [5]=> string(1) "5" [6]=> string(1) "6" [7]=> string(1) "7" [8]=> string(2) "36" [9]=> string(1) "8" [10]=> string(1) "9" [11]=> string(2) "10" [12]=> string(2) "11" [13]=> string(2) "38" [14]=> string(2) "12" [15]=> string(2) "13" [16]=> string(2) "14" [17]=> string(2) "15" [18]=> string(2) "37" [19]=> string(2) "39" [20]=> string(2) "16" [21]=> string(2) "17" [22]=> string(2) "18" [23]=> string(2) "19" [24]=> string(2) "20" [25]=> string(2) "32" [26]=> string(2) "21" [27]=> string(2) "22" [28]=> string(2) "23" [29]=> string(2) "24" [30]=> string(2) "25" [31]=> string(2) "26" [32]=> string(2) "27" [33]=> string(2) "28" [34]=> string(2) "29" [35]=> string(2) "30" [36]=> string(2) "31" [37]=> string(2) "33" [38]=> string(2) "34" [39]=> string(2) "35" }
**Note: The the values may not be ordered
isset()check on that array for the lookup.