




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
Project1MemberManagementSystemSchoolofSoftware,ChengduPolytechnicLecturer:MuQichunTask3ObtainingBack-endDataFormSettingClicktheSubmitbuttonontheregistrationpage,thesystemwillautomaticallyredirecttotheback-endpageappointedbyaction.Ontheback-endpage,usetheglobalarray$_GETor$_POSTtoobtainthedatasubmittedbyafront-endform.Themethodforobtainingdataisdeterminedbythedatasubmissionmethodusedbythefront-endform.Ifthefrontendusesthegetmethodtosubmitthedata,apply$_GET.Ifthefrontendusesthepostmethodtosubmitthedata,apply$_POST.Ofcourse,theglobalarray$_REQUESTcanbeusedforreadingthedatasubmittedbythefront-endform,whichcanbereadwithgetandpostboth.Toobtainthevaluecompletedbythefront-endforminthebackend,somesettingsmustbemadetotheformfield.Addoneattributenametoeachformfield.Addthesameattributenametotheradiobuttons(orcheckboxes)ofthesamegroup.Addoneattributevaluetotheradiobuttonsandthecheckbox.Forthecheckbox,settheattributenameintheformofonedata.ClicktheSubmitbuttonintheform,thesystemwillredirecttothepageappointedbytheattributeactionofthetagform,andcarrycorrespondingfront-enddata.Therearetwocarryingmethods,namelygetandpost,whichcanbesetthroughtheattributemethodofthetagform.Differencesbetweengetandpostinclude:Getisunsafe,becausethedataisplacedinarequestedURLinthetransmissionprocess.However,alloperationsofPostareinvisibletotheuser.Gettransmitsasmallamountofdata,mainlyduetotherestrictiononURLlength,whilePosttransmitsalargeamountofdata,withnorestrictionsmadebydefaultingeneralcase.ThevaluesofdatasetsinFormrestrictedbyGetmustbeASCIIcharacters,whilePostsupporttheentireISO10646characterset.However,theexecutionefficiencyofGetishigherthanthatofPost.Getisthedefaultmethodforsubmittingaform.ObtainingFormDatawithPHPClicktheSubmitbuttonontheregistrationpage,thesystemwillautomaticallyredirecttotheback-endpageappointedbyaction.Ontheback-endpage,usetheglobalarray$_GETor$_POSTtoobtainthedatasubmittedbyafront-endform.Themethodforobtainingdataisdeterminedbythedatasubmissionmethodusedbythefront-endform.Ifthefrontendusesthegetmethodtosubmitthedata,apply$_GET.Ifthefrontendusesthepostmethodtosubmitthedata,apply$_POST.Ofcourse,theglobalarray$_REQUESTcanbeusedforreadingthedatasubmittedbythefront-endform,whichcanbereadwithgetandpostboth.CreatethepostReg.phpfileinaproject,andenterthefollowingcodestoreadandtestback-enddata.ObtainingFormDatawithPHPRunthesingup.phpfile,entereachdataintheform,clicktheSubmitbutton,entertheback-endpage,andviewtheoperatingresults.ObtainingFormDatawithPHPApredefinedvariable$_POSTisusedforcollectingvaluesinformsfrommethod="post"inPHP,andisofthearraytype.MessagessentfromaformwiththePOSTmethodareinvisibletoallpersons(notdisplayedintheaddressbarofthebrowser),withoutanyrestrictiononitsvolume.However,bydefault,themaximuminformationsentbythePOSTmethodis8MB(whichcanbesetpost_max_sizeinthephp.inifile).Doyourememberhowtosettheattributenameinafront-endformforeachcontrol.Use$_POST['username']toreadthevalueofacontrolwiththenameofusernameofthefrom-endformfromaback-endfile.Asmultiplevaluescanbeselectedinthecheckbox,thenameintheformofthefunctionformfav[]isusedinafront-endform.Certainly,onearrayisreadattheendwith$_POST['fav'].UsethefunctionechotooutputthevalueofonevariableinPHP.However,asdirectoutputisnotavailableforarrays,thefunctionimplodeisusedforprocessing.Thefunctionimplode()returnsacharacterstringcomposedofarrayelements,andthefirstparameterstipulatesthecontentplacedbetweenarrayelements,withthedefaultvalueof""(nullcharacterstring).Here,acommaisusedforconnectingthearrayelements.Thesecondparameteristhespecificarraytobeprocessed.ObtainingFormDatawithPHPInthesexcontrolinafront-endform,thevalue1issetfortheoption“Male”,whilethevalue0issetfortheoption“Female”.Therefore,thevaluesofsexreadintheback-endfileare1and0.However,thevaluesarewrongif1and0aredirectlyoutputted,whichneedtoberespectivelyconvertedto“Male”and“Female”.Usetheexpression?heretofinishtheoperation.Theexpression?equatestothedoublebranchstatementif...esle.Iftheexpressionaheadof?istrue,returnthevaluebehind?.Otherwise,returnthevaluesbehind:.Judgewhether$sexequalsto1.Ifyes,output“Male”.Ifno,output“Female”.Directlyplaceacharacterstringinapairofquotationmarksorsinglequotationmarksinthefunctionecho,tooutputthecharacterstringasis.Directlyplacethevariablesbetweendoublequotationmarkstooutputthem.However,ifonevariableisdirectlyinsertedbetweensinglequotationmarks,thevariablescannotbeparsed,withthenameofthevariableitselfdirectlydisplayedinthebrowser.Insuchcase,connectorsareused,forexample
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 風(fēng)險(xiǎn)管理的制度與流程構(gòu)建試題及答案
- 網(wǎng)絡(luò)優(yōu)化測試的基本原則與方法試題及答案
- 2025屆上海外國語大附屬外國語學(xué)校數(shù)學(xué)八下期末達(dá)標(biāo)檢測試題含解析
- 盤點(diǎn)2025年VB考試回顧及試題及答案
- 電子文檔處理與管理技巧試題及答案
- 軟件設(shè)計(jì)師考試合作與協(xié)同工具試題及答案
- 有效利用閑置資源提升生產(chǎn)力計(jì)劃
- 未來市場競爭格局的戰(zhàn)略調(diào)整試題及答案
- 美術(shù)教育心理學(xué)培訓(xùn)活動(dòng)計(jì)劃
- 鄉(xiāng)鎮(zhèn)商圈保安工作總結(jié)與發(fā)展計(jì)劃
- 2025廣西中馬欽州產(chǎn)業(yè)園區(qū)投資控股集團(tuán)限公司招聘49人易考易錯(cuò)模擬試題(共500題)試卷后附參考答案
- 甲狀腺癌護(hù)理疑難病例討論
- 學(xué)校低值易耗品采購與管理流程
- 高等數(shù)學(xué)(慕課版)教案 教學(xué)設(shè)計(jì)-5.4 定積分的應(yīng)用;5.5 反常積分
- 一次電氣設(shè)備調(diào)試作業(yè)A票
- 車載感知與融合算法-深度研究
- 社會(huì)工作發(fā)展趨勢(shì)-深度研究
- 乙狀結(jié)腸癌相關(guān)知識(shí)
- 部編版二年級(jí)語文《古詩詞大會(huì)比賽》精美課件
- 金融學(xué)科研究新高度:黃達(dá)《金融學(xué)》2025課件解讀
- 遼寧省沈陽市2025年高中三年級(jí)教學(xué)質(zhì)量監(jiān)測(一)地理試題(含答案)
評(píng)論
0/150
提交評(píng)論