Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: problem z echo() pomóżcie mi :)
Forum PHP.pl > Forum > Przedszkole
lopez86
Zrobiłem coś takiego: jeżeli jest prawidłowo wpisany w formularzu username to wyskakuje 2 razy a ma wyskakiwać raz echo : ma pisać step one completed itd i adres url a na stronie powtarza te wpisy dwukrotnie i nie wiem dlaczego: wygląda to tak : step one completed itd... adres url z drugiego echa i znowu step one completed i adres url sadsmiley02.gif


  1. <?
  2.  
  3. if (empty($_GET['submit']) && !eregi(" ",$username)){
  4.  
  5. $homepath = "/home2/lopez86100/domains/easywebcity.com/public_html/article/"; 
  6. $filesdi = "/home2/lopez86100/domains/easywebcity.com/public_html/add/";
  7.  
  8.  
  9.  
  10. $cpFiles = array("index.txt","pss.txt");
  11.  
  12. $username=$_GET['username'];
  13. $templates = $_GET['template'];
  14. $filesdir = $filesdi.$templates;
  15. reset($cpFiles);
  16.  
  17.  
  18. $userDir = $homepath.$username;
  19. //create the new directory
  20. $newDir = mkdir($userDir, 0777);
  21.  
  22.  
  23. $userDir = $homepath.$_GET['username'];
  24.  
  25.  
  26. foreach($cpFiles as $theFile) {
  27.  
  28. $cpFiles = $cpFiless;
  29. copy($filesdir."/".$theFile,$userDir."/".$theFile);
  30. chmod($userDir."/".$theFile,0777);
  31.  
  32. echo "<div align="center"><strong>Step one completed !<p>Go to step 2 !</strong></div>";
  33.  
  34. echo "(http://www.easywebcity.com/$username)";
  35. }
  36.  
  37.  
  38. }
  39.  
  40. if (empty($_GET['submit']) && eregi(" ",$username)){
  41. exit("don't use spaces");
  42. }
  43. exit();
  44. ?>
fiszol
wywala dwa razy bo masz to w pętli:
  1. <?php
  2. foreach($cpFiles as $theFile) {
  3.  
  4. $cpFiles = $cpFiless;
  5. copy($filesdir."/".$theFile,$userDir."/".$theFile);
  6. chmod($userDir."/".$theFile,0777);
  7.  
  8. echo "<div align="center"><strong>Step one completed !<p>Go to step 2 !</strong></div>";
  9.  
  10. echo "(http://www.easywebcity.com/$username)";
  11. }
  12. ?>

spróbuj tak:
  1. <?php
  2. foreach($cpFiles as $theFile) {
  3.  
  4. $cpFiles = $cpFiless;
  5. copy($filesdir."/".$theFile,$userDir."/".$theFile);
  6. chmod($userDir."/".$theFile,0777);
  7. }
  8. echo "<div align="center"><strong>Step one completed !<p>Go to step 2 !</strong></div>";
  9.  
  10. echo "(http://www.easywebcity.com/$username)";
  11. ?>
KotDomowy
Może dlatego, że

  1. <?php
  2. echo "<div align="center"><strong>Step one completed !<p>Go to step 2 !</strong></div>";
  3. ?>


masz w pętli foreach? smile.gif
lopez86
Działa dziękuję wam smile.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.