leimis Posted October 25, 2004 Report Share Posted October 25, 2004 Esmu iesaaceejs PHP un taisu augshaa savu pirmo lapu, Probleema taada, ka spiezhot F5, t.i. refreshot lapu manu visu laiku pievieno vienu un to pahsu komentu. Jo dati no komenta formas tiek nosuutiiti uz to pashu lapu kuraa glabaajas komenti. Bet es domaaju ka jaabuut kaadai funkcijai kas izdzeeshu mainiigo $_POST['mainiigais'] uz visiem laikiem Link to comment Share on other sites More sharing options...
рпр Posted October 25, 2004 Report Share Posted October 25, 2004 izdzeest jau tu vari izdzeest, bet kaada no taa jeega, ja nospiezjot refresh browzeris suuta veelreiz tev tos pashus datus. risinaajums ir paaradreset uz jaunu lapu, taadaa veidaa refreshojot vairs netiks suutiiti post dati. peec datu ievades pievieno header('location: rezultaatu_lapa.php'); skaties lai pirsm taas funkcias netiktu izvadiiti citi dati. Link to comment Share on other sites More sharing options...
ruksis333 Posted October 25, 2004 Report Share Posted October 25, 2004 Re ku shiten jau ir bijusi runa par Refresh un kaa to noveerst: http://php.lv/f/index.php?showtopic=833&hl=refresh http://php.lv/f/index.php?showtopic=846&hl=refresh Link to comment Share on other sites More sharing options...
leimis Posted October 25, 2004 Author Report Share Posted October 25, 2004 Pierakstiiju to hedu . Lapa aizgaaja muuzhiigaa refreshaa! un sameta n-tos komentus vienaadus Link to comment Share on other sites More sharing options...
des Posted October 25, 2004 Report Share Posted October 25, 2004 Pierakstiiju to hedu . Lapa aizgaaja muuzhiigaa refreshaa! un sameta n-tos komentus vienaadus pirms refreshoshanas (headera izsauksnanas) uztaisi paarbaudi, vai ir notikusi postoshana. if (sizeof($_POST)>0) { header("location: ....."); } Link to comment Share on other sites More sharing options...
leimis Posted October 25, 2004 Author Report Share Posted October 25, 2004 iespeejams probleema ir taada ka man hederii ir noraadiita taa pati lapa no kurienes njem to post datus <meta http-equiv="refresh" content="; url=Zinja.php"> Bet pievienojot komentaaru normaali ir jaabuut taa lai es redzu visus ieprieksheejos komentaarus un tad beigaas savu. Tas noziimee. Ka piespiezhot pogu apstiprinot komentaaru man no saakuma jaataisa vaicaajums insert into, paarbaudot vai pievienotie dati nav tukshums un peec tam izdrukaat visus komentaarus ar attieciigo zinjas id. Scenaarija sheema. tabulas izvadiishana piemeeram ar id 2 .... Komentaara forma <form action=\"Zinja.php?ID=$ID\" method=\"post\"> .... <input type=\"submit\" value=\"Ievietot\"><input type=\"reset\" value=\"Dzeest\"> ... Paarbaude vai kaut kas ierakstiits tad izdara vaicaajumu insert into peec vaicaajuma! else{ print("nekaa");} if (sizeof($_POST)>0) { header('location: Zinja.php'); } Rezultaats: scenaarijs joprojaam nestraadaa. Ja ieraksta head daljaa <meta http-equiv="refresh" content="; url=http://"> tad notiekaas iecikloshanaas un aizdirsta visa datu baaze. ja bez tad saka post data allready sent Link to comment Share on other sites More sharing options...
des Posted October 25, 2004 Report Share Posted October 25, 2004 <meta http-equiv="refresh" content="; url=Zinja.php"> Vaac aaraa to rindinju! Taa tieshaam taisa muuzhiigo refreshu :) Visu insertoshanu taisi pashaa augshaa (pirms jebkas tiek izvadiits uz paarluukprogrammaa). if (sizeof($_POST)>0) { insertoshana datubaazee. header('location: Zinja.php'); } Link to comment Share on other sites More sharing options...
leimis Posted October 25, 2004 Author Report Share Posted October 25, 2004 Uzrakstiiju vaicaajumu pashaa augshaa vaicaajums tiek pievienots kopaa ar warningu insertoshana datubaazee. Warning: Cannot modify header information - headers already sent by (output started at E:\Maajas_lapa\Zinja.php:7) in E:\Maajas_lapa\Zinja.php on line 86 86 line: header('location: Zinja.php'); spiezhot f5 joprojaam zinjas tiek liktas iekshaa vaicaajums izkataas shaads $query =mysql_query("INSERT into Komentaari(Vaards, mail, web, komentaars, Zinjas_ID, Laiks) VALUES('".$_POST['vaards']."', '".$_POST['mail']."', '".$_POST['web']."', '".$_POST['Komentaars']."', '$ID', now())"); @mysql_free_result ($query); if (sizeof($_POST)>0) { print("insertoshana datubaazee."); header('location: Zinja.php'); }} figuur iekavu meegjinaaju likt gan peec heder gan arii pirms peedeejaa if Link to comment Share on other sites More sharing options...
des Posted October 25, 2004 Report Share Posted October 25, 2004 Davai, iepastee http://paste.php.lv visu to zinja.php & tad razbirjomsa :) Pashaa augshaa tas, noziimee pirms visa outputa - pirms jebkaada echo vai pirms jebkaada ne-php (kas aarpus <?php ?>). Ja vinjsh bljaustaas, ka headers already sent, tas noziimee, ka kaut kaads outputs uz browseri tomeer jau ir noticis! Link to comment Share on other sites More sharing options...
leimis Posted October 25, 2004 Author Report Share Posted October 25, 2004 http://paste.php.lv/1307 Link to comment Share on other sites More sharing options...
leimis Posted October 25, 2004 Author Report Share Posted October 25, 2004 Buutu labi dabuut kaut kaadu paraugu, sheemu peec kaadas ir pareizi kodeet. Bet shaadi uz aklo programmeet ir vienas mociibas. Nevienas graamatas normaalaa valodaa ar nav. Paldies jau ieprieksh Link to comment Share on other sites More sharing options...
Aleksejs Posted October 25, 2004 Report Share Posted October 25, 2004 Buutu labi dabuut kaut kaadu paraugu, sheemu peec kaadas ir pareizi kodeet. Bet shaadi uz aklo programmeet ir vienas mociibas. Nevienas graamatas normaalaa valodaa ar nav. Paldies jau ieprieksh Un "normālā" valoda būtu kura? (-; Link to comment Share on other sites More sharing options...
leimis Posted October 25, 2004 Author Report Share Posted October 25, 2004 Dzimatajaa latvieshu Link to comment Share on other sites More sharing options...
des Posted October 25, 2004 Report Share Posted October 25, 2004 Buutu labi dabuut kaut kaadu paraugu, sheemu peec kaadas ir pareizi kodeet. Bet shaadi uz aklo programmeet ir vienas mociibas. Nevienas graamatas normaalaa valodaa ar nav. Paldies jau ieprieksh Pameegjini shito http://paste.php.lv/1313 MySql datu baazei ir jaapiekonekteejas vienreiz, pashaa saakumaa - nav jaakonekteejas atkal pirms katra jauna kverija :) Saakumaa visiem iet gruuti, bet ja sho gruutumu salauzh, tad peec tam kad aiziet, tad aiziet :) Link to comment Share on other sites More sharing options...
Aleksejs Posted October 25, 2004 Report Share Posted October 25, 2004 Dzimatajaa latvieshu Vienīgā iznākusī grāmata ir "PHP soli pa solim". Ja gribās uzzināt kaut ko par programmēšanu kā tādu, tad latviešu valodā ir šādas adreses: http://www.boot.lv/forums/viewtopic.php?t=7159 Link to comment Share on other sites More sharing options...
Recommended Posts