Cov foos siv tau nyob rau ntawm nplooj ntawv web site txhawm rau nkag mus rau cov ntaub ntawv, uas yog tom qab ntawd xa mus rau lub server thiab txheej txheem. Lawv sau cov ntaub ntawv rau kev cuv npe, tus ID nkag mus thiab tus password nkag mus rau lub xaib, xa lus. Daim foos code muaj nyob nrog thiab daim pib. Daim ntawv yog tsim los siv cov lus html markup, thiab cov ntaub ntawv nkag rau tom qab ntawd ua tiav los ntawm tsab ntawv hauv php programming lus.
Cov Lus Qhia
Kauj ruam 1
Sau tus foos ib daim foos los xa lus. Teeb tus cwj pwm rau cov ntawv qhia. Lub npe cwj pwm yog lub npe ntawm daim ntawv, piv txwv li "form1". Los ntawm kev teev nws lub npe, yog tias koj muaj ntau daim ntawv, koj tuaj yeem xa mus rau lawv txhua tus nyias. Qhov kev txiav txim attribute taw rau handler tsab ntawv cov ntaub ntawv nyob qhov twg cov ntaub ntawv cov ntaub ntawv yuav xa tom qab cov tswv yim, ntawm no cov ntaub ntawv ua yuav yog message.php. Cov qauv txheej txheem tuaj yeem muaj qhov muaj nuj nqis "tau txais" thiab "post" (siv ntau dua), uas txhais tau tias, txhua ntu, qhib thiab muab cov ntaub ntawv xa mus. Nov yog tus qauv uas cov ntaub ntawv nkag los raug xa mus rau tus neeg rau zaub mov. Nws hloov tawm txoj kab hauv qab no:
Kauj ruam 2
Ntxiv lub npe rau hauv daim foos:
Koj lub npe:
… Tag
yuav teeb tsa ib kab lus tshiab, thiab
yuav muab cov kab txuas ntxiv rau.
Kauj ruam 3
Ntxiv rau lub thawv ntawv - siv tus lossis nws cov cwj pwm: hom, npe, maxlength. Hom ntaus nqi txhais qhov hom ntawm lub ntsiab nkag (hauv qhov no, cov ntawv nyeem yog ntawv nyeem). Lub npe cwj pwm yog lub npe ntawm cov khoom, piv txwv li, "thawj kab". Siv maxlength los teev tus naj npawb ntawm cov cim ntau tshaj, piv txwv li, 20. Txoj hlua saib:
Kauj ruam 4
Ntxiv lub npe rau hauv daim foos:
Sau koj cov lus ntawv:
Kauj ruam 5
Tsim ib daim teb rau cov lus nws tus kheej. Siv daim ntawv cim npe. Qhia lub npe rau daim teb, piv txwv li "lus". Qhia kom meej teb qhov siab - tus naj npawb ntawm cov kab (kab), zoo li teb qhov dav (tus naj npawb ntawm kab) - cols. Cov kab yuav zoo li no:
Kauj Ruam 6
Yeem, ua teb rau teev qhov chaw nyob email: Koj email:
Kauj Ruam 7
Tsim khawm rau xa cov ntaub ntawv. Siv daim pib nrog cov khoom. Tus nqi "xa tawm" ntawm hom ntaus ntawv yuav xa cov ntaub ntawv, tus nqi ntaus nqi yuav teeb tsa tus nqi ntawm lub pob. Cov kab yuav tig tawm:. Daim foos tau npaj txhij, tam sim no ntxiv daim pib dai
Kauj ruam 8
Ntxiv cov txiaj ntsig cov txiaj ntsig mus rau nplooj ntawv web file thiab saib qhov tshwm sim hauv qhov browser
Kauj Ruam 9
Qhov no yog qhov algorithm rau kev tsim daim ntawv tshaj tawm siv html. Qhov no tsis txaus rau kev ua haujlwm ntawm kev xa ntawv ntawm qhov xaib. Yog li, tseem tsim cov ntawv files.php nrog cov ntawv sau rau kev ua cov ntaub ntawv xa tawm, cov ntawv yuav tsum nyob hauv tib lub tais nrog cov ntaub ntawv xaib hauv qab. Tsis tas li ntawd sau cia thaum pib ntawm kev sib ntsib, thiab lwm yam.