紧急求助! php 如何提交多个多项列表
小白发帖求助。。。如截图所示,目前网页上有4个单选列表和多个多选列表,目的是用户点击Submit 按钮,后台获取已选择的选项,然后再在数据库中搜索,最后返回相应的搜索结果。
可是现在我都不知道如何在点击Submit后,获取user的选择的选项。 就是说关于Submit 的PHP 代码该怎么写啊啊。中间貌似还要涉及到转义字符的问题,求大家帮助!
附:代码片段和网页截图 (表单里的内容都是一些机械的feature,希望用户可以通过选择feature,搜索到所需的机械型号)
1) 这是一个单选列表
- HTML code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><div id="fourth" class="selection_options"><select name="case_mounting" size="1" title="case and mounting"> <option value=' 1" SQR. PANEL'> 1" SQR. PANEL</option> <option value='0.95"X1.75" PANEL'>0.95"X1.75" PANEL</option> <option value='2"X3" FLAT PACK PANEL'>2"X3" FLAT PACK PANEL</option> <option value="HAND HELD CALIBRATOR">HAND HELD CALIBRATOR</option> <option value="EXP. PROOF CONDUIT">EXP. PROOF CONDUIT</option> <option value='1.45"X2.55" PANEL'>1.45"X2.55" PANEL</option> <option value='NEMA 4X2.6"X3.7" CONDUIT/WALL'>NEMA 4X2.6"X3.7" CONDUIT/WALL</option> <option value='1.6"X2" PANEL'>1.6"X2" PANEL</option> <option value='AVIATION 1" DIAMETER'>AVIATION 1" DIAMETER</option> <option value="DINRAIL">DINRAIL</option> <option value='3 1/2" BARREL PANEL'>3 1/2" BARREL PANEL</option> <option value="1/8 DIN PANEL">1/8 DIN PANEL</option> <option value="1/4 DIN PANEL">1/4 DIN PANEL</option> <option value='4" SWITCHBOARD PANEL'>4" SWITCHBOARD PANEL</option> <option value='1.5"X2.9"X2" PANEL'>1.5"X2.9"X2" PANEL</option> <option value='6"X1" EDGEWISE PANEL'>6"X1" EDGEWISE PANEL</option> <option value='6"X1.75" EDGEWISE PANEL'>6"X1.75" EDGEWISE PANEL</option> <option value='6.6"X1.4" EDGEWISE PANEL'>6.6"X1.4" EDGEWISE PANEL</option> <option value='11.3"X1.4" EDGEWISE PANEL'>11.3"X1.4" EDGEWISE PANEL</option> <option value='7"X1.4" EDGEWISE PANEL'>7"X1.4" EDGEWISE PANEL</option> <option value='7.3"X2.8" EDGEWISE PANEL'>7.3"X2.8" EDGEWISE PANEL</option> <option value='6.3"X2.8 EDGE PANEL '>6.3"X2.8 EDGE PANEL </option> <option value='5.7"X1.9" EDGE PANEL'>5.7"X1.9" EDGE PANEL</option> <option value='5.7"X2.84" EDGE PANEL'>5.7"X2.84" EDGE PANEL</option> <option value="NAKED PANEL/PCB MOUNT">NAKED PANEL/PCB MOUNT</option> <option value='6"X3.1" EDGE PANEL'>6"X3.1" EDGE PANEL</option> <option value='6"X6"X3" SANITARY'>6"X6"X3" SANITARY</option> <option value="VARIOUS SIZES & MOUNTING">VARIOUS SIZES & MOUNTING</option></select></div>
2) 这是其中一个复选列表
- HTML code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><div id="fifth" class="selection_name">Outputs (Use ctrl+click to make multiple choices)</div><div id="fifth" class="selection_options"> <select name="outputs[]" size="6" multiple title="out puts"> <option value="NULL" selected> </option> <option value="ANALOG 4-20mA/VDC">ANALOG 4-20mA/VDC</option> <option value="RELAYS">RELAYS</option> <option value="OPEN COLL. XTR">OPEN COLL. XTR</option> <option value="IRDA">IRDA</option> <option value="4-20mA CALIBRATOR">4-20mA CALIBRATOR</option> <option value="WIRELESS ON REQUEST">WIRELESS ON REQUEST</option> </select><div class="clear"> </div> </div>

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

TomakePHPapplicationsfaster,followthesesteps:1)UseOpcodeCachinglikeOPcachetostoreprecompiledscriptbytecode.2)MinimizeDatabaseQueriesbyusingquerycachingandefficientindexing.3)LeveragePHP7 Featuresforbettercodeefficiency.4)ImplementCachingStrategiessuc

ToimprovePHPapplicationspeed,followthesesteps:1)EnableopcodecachingwithAPCutoreducescriptexecutiontime.2)ImplementdatabasequerycachingusingPDOtominimizedatabasehits.3)UseHTTP/2tomultiplexrequestsandreduceconnectionoverhead.4)Limitsessionusagebyclosin

Dependency injection (DI) significantly improves the testability of PHP code by explicitly transitive dependencies. 1) DI decoupling classes and specific implementations make testing and maintenance more flexible. 2) Among the three types, the constructor injects explicit expression dependencies to keep the state consistent. 3) Use DI containers to manage complex dependencies to improve code quality and development efficiency.

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.
