表单选择的URL参数

时间:2018-04-08 20:21:23

标签: javascript php forms url parameters

网址:https://www.example.com/packagesearch/?destination=Caribbean%2FMexico&departure=LHR%2CLGW%2CLTN%2CSEN%2CSTN&departureDate=2018-06-24&durationMin=7&adults=2&children=0&product=sun&rating=345&infants=0&priceMin=0&priceMax=100000

我正在寻找“目的地”,“离开”,“离开日期”,“持续时间”,“成人”,“儿童”,并在页面加载时将它们用作以下形式的预设值。

                <form method="get" action="/packagesearch/" id="hubv1search" class="clearfix" >
                    <div class="thm-tk-input-4-1 thm-tk-first-select">
                        <label>Where to?</label>
                        <select name="destination" class="select2">
        <option class="group" value="Balearics">Balearic Islands</option>
        <option value="Balearics/Ibiza">&nbsp;&nbsp;&nbsp;Ibiza</option>
        <option value="Balearics/Majorca">&nbsp;&nbsp;&nbsp;Majorca</option>
        <option value="Balearics/Menorca">&nbsp;&nbsp;&nbsp;Menorca</option>
        <option class="group" value="Bulgaria">Bulgaria</option>
        <option value="Bulgaria/Bourgas Region">&nbsp;&nbsp;&nbsp;Bourgas Region</option>
        <option value="Bulgaria/Varna Region">&nbsp;&nbsp;&nbsp;Varna Region</option>
        <option class="group" value="Canaries">Canary Islands</option>
        <option value="Canaries/Fuerteventura">&nbsp;&nbsp;&nbsp;Fuerteventura</option>
        <option value="Canaries/Gran Canaria">&nbsp;&nbsp;&nbsp;Gran Canaria</option>
        <option value="Canaries/La Palma">&nbsp;&nbsp;&nbsp;La Palma</option>
        <option value="Canaries/Lanzarote">&nbsp;&nbsp;&nbsp;Lanzarote</option>
        <option value="Canaries/Tenerife">&nbsp;&nbsp;&nbsp;Tenerife</option>
        <option class="group" value="Cape Verde">Cape Verde Islands</option>
        <option value="Cape Verde/Boa Vista">&nbsp;&nbsp;&nbsp;Boa Vista</option>
        <option value="Cape Verde/Santa Maria">&nbsp;&nbsp;&nbsp;Santa Maria</option>
        <option class="group" value="Caribbean">Caribbean</option>
        <option value="Caribbean/Antigua">&nbsp;&nbsp;&nbsp;Antigua</option>
        <option value="Caribbean/Aruba">&nbsp;&nbsp;&nbsp;Aruba</option>
        <option value="Caribbean/Bahamas">&nbsp;&nbsp;&nbsp;Bahamas</option>
        <option value="Caribbean/Barbados">&nbsp;&nbsp;&nbsp;Barbados</option>
        <option value="Caribbean/Bermuda">&nbsp;&nbsp;&nbsp;Bermuda</option>
        <option value="Caribbean/British Virgin Islands">&nbsp;&nbsp;&nbsp;British Virgin Islands</option>
        <option value="Caribbean/Costa Rica">&nbsp;&nbsp;&nbsp;Costa Rica</option>
        <option value="Caribbean/Cuba">&nbsp;&nbsp;&nbsp;Cuba</option>
        <option value="Caribbean/Dominican Republic">&nbsp;&nbsp;&nbsp;Dominican Republic</option>
        <option value="Caribbean/Grenada">&nbsp;&nbsp;&nbsp;Grenada</option>
        <option value="Caribbean/Grenadines">&nbsp;&nbsp;&nbsp;Grenadines</option>
        <option value="Caribbean/Jamaica">&nbsp;&nbsp;&nbsp;Jamaica</option>
        <option value="Caribbean/Mexico">&nbsp;&nbsp;&nbsp;Mexico</option>
        <option value="Caribbean/Saint Kitts &amp; Nevis">&nbsp;&nbsp;&nbsp;Saint Kitts &amp; Nevis</option>
        <option value="Caribbean/St. Lucia">&nbsp;&nbsp;&nbsp;St. Lucia</option>
        <option value="Caribbean/Trinidad &amp; Tobago">&nbsp;&nbsp;&nbsp;Trinidad &amp; Tobago</option>
        <option class="group" value="Croatia">Croatia</option>
        <option value="Croatia/Dalmatian Riviera">&nbsp;&nbsp;&nbsp;Dalmatian Riviera</option>
        <option value="Croatia/Dubrovnik Riviera">&nbsp;&nbsp;&nbsp;Dubrovnik Riviera</option>
        <option class="group" value="Cyprus">Cyprus</option>
        <option value="Cyprus/Larnaca Region">&nbsp;&nbsp;&nbsp;Larnaca Region</option>
        <option value="Cyprus/Paphos Region">&nbsp;&nbsp;&nbsp;Paphos Region</option>
        <option class="group" value="Egypt">Egypt</option>
        <option value="Egypt/Hurghada">&nbsp;&nbsp;&nbsp;Hurghada</option>
        <option value="Egypt/Luxor">&nbsp;&nbsp;&nbsp;Luxor</option>
        <option value="Egypt/Naama Bay">&nbsp;&nbsp;&nbsp;Naama Bay</option>
        <option value="Egypt/Nabq Bay">&nbsp;&nbsp;&nbsp;Nabq Bay</option>
        <option value="Egypt/Shark's Bay">&nbsp;&nbsp;&nbsp;Shark's Bay</option>
        <option value="Egypt/Sharm El Sheikh">&nbsp;&nbsp;&nbsp;Sharm El Sheikh</option>
        <option value="Egypt/Soma Bay">&nbsp;&nbsp;&nbsp;Soma Bay</option>
        <option class="group" value="Far East">Far East</option>
        <option value="Far East/Bali">&nbsp;&nbsp;&nbsp;Bali</option>
        <option value="Far East/Thailand">&nbsp;&nbsp;&nbsp;Thailand</option>
        <option class="group" value="Greece">Greece</option>
        <option value="Greece/Alonissos">&nbsp;&nbsp;&nbsp;Alonissos</option>
        <option value="Greece/Attica">&nbsp;&nbsp;&nbsp;Attica</option>
        <option value="Greece/Corfu">&nbsp;&nbsp;&nbsp;Corfu</option>
        <option value="Greece/Crete">&nbsp;&nbsp;&nbsp;Crete</option>
        <option value="Greece/Evia">&nbsp;&nbsp;&nbsp;Evia</option>
        <option value="Greece/Halki">&nbsp;&nbsp;&nbsp;Halki</option>
        <option value="Greece/Halkidiki">&nbsp;&nbsp;&nbsp;Halkidiki</option>
        <option value="Greece/Ios">&nbsp;&nbsp;&nbsp;Ios</option>
        <option value="Greece/Ithaka">&nbsp;&nbsp;&nbsp;Ithaka</option>
        <option value="Greece/Kalamata">&nbsp;&nbsp;&nbsp;Kalamata</option>
        <option value="Greece/Kalymnos">&nbsp;&nbsp;&nbsp;Kalymnos</option>
        <option value="Greece/Karpathos">&nbsp;&nbsp;&nbsp;Karpathos</option>
        <option value="Greece/Kefalonia">&nbsp;&nbsp;&nbsp;Kefalonia</option>
        <option value="Greece/Kos">&nbsp;&nbsp;&nbsp;Kos</option>
        <option value="Greece/Lefkada">&nbsp;&nbsp;&nbsp;Lefkada</option>
        <option value="Greece/Leros">&nbsp;&nbsp;&nbsp;Leros</option>
        <option value="Greece/Lesbos">&nbsp;&nbsp;&nbsp;Lesbos</option>
        <option value="Greece/Meganissi">&nbsp;&nbsp;&nbsp;Meganissi</option>
        <option value="Greece/Mykonos">&nbsp;&nbsp;&nbsp;Mykonos</option>
        <option value="Greece/Paros">&nbsp;&nbsp;&nbsp;Paros</option>
        <option value="Greece/Paxos">&nbsp;&nbsp;&nbsp;Paxos</option>
        <option value="Greece/Pelion">&nbsp;&nbsp;&nbsp;Pelion</option>
        <option value="Greece/Peloponnese">&nbsp;&nbsp;&nbsp;Peloponnese</option>
        <option value="Greece/Preveza">&nbsp;&nbsp;&nbsp;Preveza</option>
        <option value="Greece/Rhodes">&nbsp;&nbsp;&nbsp;Rhodes</option>
        <option value="Greece/Samos">&nbsp;&nbsp;&nbsp;Samos</option>
        <option value="Greece/Santorini">&nbsp;&nbsp;&nbsp;Santorini</option>
        <option value="Greece/Skiathos">&nbsp;&nbsp;&nbsp;Skiathos</option>
        <option value="Greece/Skopelos">&nbsp;&nbsp;&nbsp;Skopelos</option>
        <option value="Greece/Symi">&nbsp;&nbsp;&nbsp;Symi</option>
        <option value="Greece/Syros">&nbsp;&nbsp;&nbsp;Syros</option>
        <option value="Greece/Thassos">&nbsp;&nbsp;&nbsp;Thassos</option>
        <option value="Greece/Thessaloniki">&nbsp;&nbsp;&nbsp;Thessaloniki</option>
        <option value="Greece/Thessaly">&nbsp;&nbsp;&nbsp;Thessaly</option>
        <option value="Greece/Zante">&nbsp;&nbsp;&nbsp;Zante</option>
        <option class="group" value="Indian Ocean">Indian Ocean</option>
        <option value="Indian Ocean/Goa">&nbsp;&nbsp;&nbsp;Goa</option>
        <option value="Indian Ocean/India">&nbsp;&nbsp;&nbsp;India</option>
        <option value="Indian Ocean/Kerala">&nbsp;&nbsp;&nbsp;Kerala</option>
        <option value="Indian Ocean/Maldives">&nbsp;&nbsp;&nbsp;Maldives</option>
        <option value="Indian Ocean/Mauritius">&nbsp;&nbsp;&nbsp;Mauritius</option>
        <option value="Indian Ocean/Seychelles">&nbsp;&nbsp;&nbsp;Seychelles</option>
        <option value="Indian Ocean/Sri Lanka">&nbsp;&nbsp;&nbsp;Sri Lanka</option>
        <option class="group" value="Italy">Italy</option>
        <option value="Italy/Abruzzo">&nbsp;&nbsp;&nbsp;Abruzzo</option>
        <option value="Italy/Campania">&nbsp;&nbsp;&nbsp;Campania</option>
        <option value="Italy/Friuli-Venezia Giulia">&nbsp;&nbsp;&nbsp;Friuli-Venezia Giulia</option>
        <option value="Italy/Lazio">&nbsp;&nbsp;&nbsp;Lazio</option>
        <option value="Italy/Lombardy">&nbsp;&nbsp;&nbsp;Lombardy</option>
        <option value="Italy/Piemonte">&nbsp;&nbsp;&nbsp;Piemonte</option>
        <option value="Italy/Sardinia">&nbsp;&nbsp;&nbsp;Sardinia</option>
        <option value="Italy/Sicily">&nbsp;&nbsp;&nbsp;Sicily</option>
        <option value="Italy/Trentino-Alto Adige">&nbsp;&nbsp;&nbsp;Trentino-Alto Adige</option>
        <option value="Italy/Tuscany">&nbsp;&nbsp;&nbsp;Tuscany</option>
        <option value="Italy/Veneto">&nbsp;&nbsp;&nbsp;Veneto</option>
        <option class="group" value="Maltese Islands">Maltese Islands</option>
        <option value="Maltese Islands/Malta">&nbsp;&nbsp;&nbsp;Malta</option>
        <option class="group" value="Morocco">Morocco</option>
        <option value="Morocco/Agadir">&nbsp;&nbsp;&nbsp;Agadir</option>
        <option value="Morocco/Marrakech">&nbsp;&nbsp;&nbsp;Marrakech</option>
        <option class="group" value="Portugal">Portugal</option>
        <option value="Portugal/Algarve">&nbsp;&nbsp;&nbsp;Algarve</option>
        <option value="Portugal/Madeira">&nbsp;&nbsp;&nbsp;Madeira</option>
        <option class="group" value="Spain">Spain</option>
        <option value="Spain/Costa Blanca">&nbsp;&nbsp;&nbsp;Costa Blanca</option>
        <option value="Spain/Costa Brava">&nbsp;&nbsp;&nbsp;Costa Brava</option>
        <option value="Spain/Costa Del Sol">&nbsp;&nbsp;&nbsp;Costa Del Sol</option>
        <option value="Spain/Costa Dorada">&nbsp;&nbsp;&nbsp;Costa Dorada</option>
        <option class="group" value="Tunisia">Tunisia</option>
        <option value="Tunisia/Tunis">&nbsp;&nbsp;&nbsp;Tunis</option>
        <option class="group" value="Turkey">Turkey</option>
        <option value="Turkey/Antalya">&nbsp;&nbsp;&nbsp;Antalya Area</option>
        <option value="Turkey/Bodrum">&nbsp;&nbsp;&nbsp;Bodrum Area</option>
        <option value="Turkey/Dalaman">&nbsp;&nbsp;&nbsp;Dalaman Area</option>
        <option value="Turkey/Izmir">&nbsp;&nbsp;&nbsp;Izmir</option>
        <option class="group" value="USA">USA</option>
        <option value="USA/California">&nbsp;&nbsp;&nbsp;California (Los Angeles)</option>
        <option value="USA/Florida">&nbsp;&nbsp;&nbsp;Florida</option>
        <option value="USA/Nevada">&nbsp;&nbsp;&nbsp;Nevada (Las Vegas)</option>
                        </select>
                    </div>
                    <div class="thm-tk-input-5-1">
                        <label>Fly from</label>
                                                    <select name="departure" class="select2">
                <option class="group" value="LHR,LGW,LTN,SEN,STN">All London</option>
                <option value="LGW">&nbsp;&nbsp;&nbsp;&nbsp;London Gatwick</option>
                <option value="LHR">&nbsp;&nbsp;&nbsp;&nbsp;London Heathrow</option>
                <option value="LTN">&nbsp;&nbsp;&nbsp;&nbsp;London Luton</option>
                <option value="SEN">&nbsp;&nbsp;&nbsp;&nbsp;London Southend</option>
                <option value="STN">&nbsp;&nbsp;&nbsp;&nbsp;London Stansted</option>
                <option class="group" value="BHX,EMA">All Midlands</option>
                <option value="BHX">&nbsp;&nbsp;&nbsp;&nbsp;Birmingham</option>
                <option value="EMA">&nbsp;&nbsp;&nbsp;&nbsp;East Midlands</option>
                <option class="group" value="MME,NCL">All North East</option>
                <option value="MME">&nbsp;&nbsp;&nbsp;&nbsp;Durham Tees Valley</option>
                <option value="NCL">&nbsp;&nbsp;&nbsp;&nbsp;Newcastle</option>
                <option class="group" value="BLK,LPL,MAN">All North West</option>
                <option value="BLK">&nbsp;&nbsp;&nbsp;&nbsp;Blackpool</option>
                <option value="LPL">&nbsp;&nbsp;&nbsp;&nbsp;Liverpool</option>
                <option value="MAN">&nbsp;&nbsp;&nbsp;&nbsp;Manchester</option>
                <option class="group" value="BFS,BHD,LDY">All Northern Ireland</option>
                <option value="BFS">&nbsp;&nbsp;&nbsp;&nbsp;Belfast</option>
                <option value="BHD">&nbsp;&nbsp;&nbsp;&nbsp;Belfast  City</option>
                <option value="LDY">&nbsp;&nbsp;&nbsp;&nbsp;City Of Derry</option>
                <option class="group" value="ABZ,EDI,GLA,PIK,INV">All Scotland</option>
                <option value="ABZ">&nbsp;&nbsp;&nbsp;&nbsp;Aberdeen</option>
                <option value="EDI">&nbsp;&nbsp;&nbsp;&nbsp;Edinburgh</option>
                <option value="GLA">&nbsp;&nbsp;&nbsp;&nbsp;Glasgow</option>
                <option value="PIK">&nbsp;&nbsp;&nbsp;&nbsp;Glasgow Prestwick</option>
                <option value="INV">&nbsp;&nbsp;&nbsp;&nbsp;Inverness</option>
                <option class="group" value="BOH,SOU">All South</option>
                <option value="BOH">&nbsp;&nbsp;&nbsp;&nbsp;Bournemouth</option>
                <option value="SOU">&nbsp;&nbsp;&nbsp;&nbsp;Southampton</option>
                <option class="group" value="BRS,CWL,EXT,NQY">All West Country + Wales</option>
                <option value="BRS">&nbsp;&nbsp;&nbsp;&nbsp;Bristol</option>
                <option value="CWL">&nbsp;&nbsp;&nbsp;&nbsp;Cardiff</option>
                <option value="EXT">&nbsp;&nbsp;&nbsp;&nbsp;Exeter</option>
                <option value="NQY">&nbsp;&nbsp;&nbsp;&nbsp;Newquay</option>
                <option class="group" value="DSA,HUY,LBA">All Yorkshire</option>
                <option value="DSA">&nbsp;&nbsp;&nbsp;&nbsp;Doncaster Sheffield</option>
                <option value="HUY">&nbsp;&nbsp;&nbsp;&nbsp;Humberside</option>
                <option value="LBA">&nbsp;&nbsp;&nbsp;&nbsp;Leeds Bradford</option>
                <option class="group" value="NWI">All East Anglia</option>
                <option value="NWI">&nbsp;&nbsp;&nbsp;&nbsp;Norwich</option>
                        </select>
                    </div>
                    <div class="thm-tk-input-5-1">
                        <label>When</label>
                        <input type="text" name="departureDate" class="thm-date-picker" placeholder="Select a date">
                    </div>
                    <div class="thm-tk-input-5-1">
                        <label>Duration</label>
                        <select name="durationMin" class="select2">
                <option value="7">Any</option>
                <option value="7">7 Nights</option>
                <option value="10">10 Nights</option>
                <option value="11">11 Nights</option>
                <option value="14">14 Nights</option>
                <option value="21">21 Nights</option>
                        </select>
                    </div>
                    <div class="thm-tk-input-15">
                        <div class="thm-tk-input-2-1">
                            <label>Adults</label>
                            <select name="adults" class="select2">
                                <option value="2"><?php esc_html_e('2', 'themeum-core'); ?></option>
                                <option value="3"><?php esc_html_e('3', 'themeum-core'); ?></option>
                                <option value="4"><?php esc_html_e('4', 'themeum-core'); ?></option>
                                <option value="5"><?php esc_html_e('5', 'themeum-core'); ?></option>
                                <option value="6"><?php esc_html_e('6', 'themeum-core'); ?></option>
                                <option value="7"><?php esc_html_e('7', 'themeum-core'); ?></option>
                                <option value="8"><?php esc_html_e('8', 'themeum-core'); ?></option>
                            </select>
                        </div>
                        <div class="thm-tk-input-2-1">
                            <label>Children</label>
                            <select name="children" class="select2">
                                <option value="0"><?php esc_html_e('0', 'themeum-core'); ?></option>
                                <option value="1"><?php esc_html_e('1', 'themeum-core'); ?></option>
                                <option value="2"><?php esc_html_e('2', 'themeum-core'); ?></option>
                                <option value="3"><?php esc_html_e('3', 'themeum-core'); ?></option>
                                <option value="4"><?php esc_html_e('4', 'themeum-core'); ?></option>
                                <option value="5"><?php esc_html_e('5', 'themeum-core'); ?></option>
                                <option value="6"><?php esc_html_e('6', 'themeum-core'); ?></option>
                                <option value="7"><?php esc_html_e('7', 'themeum-core'); ?></option>
                                <option value="8"><?php esc_html_e('8', 'themeum-core'); ?></option>
                            </select>
                        </div>

                    </div>
                    <button class="btn btn-primary thm-tk-search-btn" id="flight-search" type="submit"><?php esc_html_e('Search', 'themeum-core'); ?></button><br>
                    <input type="hidden" name="product" value="sun"><input type="hidden" name="rating" value="345"><input type="hidden" name="infants" value="0"><input type="hidden" name="priceMin" value="0"><input type="hidden" name="priceMax" value="100000">
            </div></form>

0 个答案:

没有答案