




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quá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等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年分期付款租賃房屋合同樣本
- 2025年企業(yè)會議室租賃合同模板
- 2025年農(nóng)村機電井施工承包合同
- 2025年相聲演出合同模版
- 2025年二手房產(chǎn)買賣合同官方模板
- 2025年公共藝術(shù)雕塑工程合同
- 2025年土地使用權(quán)轉(zhuǎn)讓合同爭議解決
- 2025年合作舉辦培訓班共同經(jīng)營合同協(xié)議案例
- 第17課《愛蓮說》教學設(shè)計-2024-2025學年統(tǒng)編版語文七年級下冊
- 2025年共同遵守的項目策劃安全合同
- 2023-2024學年湖南師大附中高一(下)入學數(shù)學試卷(含解析)
- 有色金屬冶金課件
- 公司留人方案
- 乒乓球基礎(chǔ)知識與技巧教案
- 智慧教育與個性化學習理論與實踐研究
- Mob研究院識具-2024年文創(chuàng)行業(yè)報告
- 親子教育活動指導課件
- 青島啤酒企業(yè)文化
- 中華民族的形成與發(fā)展(原版)
- 雪鐵龍云逸C4說明書
- 《健美操裁判法》課件
評論
0/150
提交評論