illegal Posted May 20, 2009 Report Share Posted May 20, 2009 <html> <body bgcolor="99ccff"> <center> </center> <form action="index.php" method=POST> Kas noticis ?: <input type=text name=user> <br/> Kura vieta ?: <input type=text name=user2> <br/> <input type=submit value="Pievienot/Atjauninat"><p> </form> <?php $user=$_POST['user']; $user2=$_POST['user2']; echo "<br />"; $file=fopen("tests.txt","a+") ; fwrite($file,"<br>Kas: "); fwrite($file,$user); fwrite($file,"<br/>Kur: "); fwrite($file,$user2); fclose ($file); ?> </body> </html> Sveiki.... Man liekas ka tas ir ljoti vienkaarshi, bet google kaut kaa nesanaak sameklet :( ka lai uz pogas "Pievienot/Atjauninat" uzliek taa, ka iegust informaciju no laukiem user un user2 un tai pashaa laikaa aiziet uz citu lapu... Bushu pateicigs, ja kads vareetu izskaidrot :) Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted May 20, 2009 Report Share Posted May 20, 2009 mekle peec redirect Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted May 20, 2009 Report Share Posted May 20, 2009 Aizsūta uz citu lapu ar header('Location: http://www.tavalapa.ta/citalapa.php'); Tavā kodā gan ir jāveic nelielas izmaiņas, jo header drīkst sūtīt tikai pirms ir sākusies jebkāda veida izvade: <?php if(array_key_exists('user',$_POST) && array_key_exists('user2', $_POST)){ $user=$_POST['user']; $user2=$_POST['user2']; $file=fopen("tests.txt","a+"); fwrite($file,"<br>Kas: "); fwrite($file,$user); fwrite($file,"<br/>Kur: "); fwrite($file,$user2); fclose ($file); header('Location: http://citaslapasadrese'); } else{ echo "<html> <body bgcolor='99ccff'> <center> </center> <form action='index.php' method=POST> Kas noticis ?: <input type=text name=user> <br/> Kura vieta ?: <input type=text name=user2> <br/> <input type=submit value='Pievienot/Atjauninat'><p> </form> </body> </html>"; } ?> Quote Link to comment Share on other sites More sharing options...
v3rb0 Posted May 20, 2009 Report Share Posted May 20, 2009 Tām darbībām ar failiem vajag kļūdu apstrādi, citādi tās izmetīs outputā kādu klūdas paziņojumu, vai nu vismaz pirms/pēc darbošanās ar failiem ob_start()/ob_get_clean() pielikt. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.