Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> instrukcja if
-PHP_Newbie-
post
Post #1





Goście







chcę porównać dane wysyłane z dokumentu
dokument1.php
Kod
<form action="dokument2.php" method="get">
  <input type="text" name="usname">
  <input type="submit" name="check" value="sprawdz">
</form>

do
dokument2.php
  1. <?php
  2. $username = newbie;
  3. if (username = usname) {
  4. ?>
  5. <p> True </p>
  6. <?php
  7. } else {
  8. ?>
  9. <p> False </p>
  10. <?php
  11. }
  12. ?>


to nie dziala czemu??
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
powker1
post
Post #2





Grupa: Zarejestrowani
Postów: 59
Pomógł: 0
Dołączył: 16.05.2005
Skąd: 3Miasto

Ostrzeżenie: (0%)
-----


sprubuj

  1. <?php
  2. $username = newbie;
  3. if (username == usname) {
  4. ?>
  5. <p> True </p>
  6. <?php
  7. } else {
  8. ?>
  9. <p> False </p>
  10. <?php
  11. }
  12. ?>

(IMG:http://forum.php.pl/style_emoticons/default/snitch.gif)

Ten post edytował powker1 6.06.2005, 16:31:39
Go to the top of the page
+Quote Post
Fipaj
post
Post #3





Grupa: Zarejestrowani
Postów: 691
Pomógł: 0
Dołączył: 19.01.2005
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


  1. <?php
  2. $username = 'newbie';
  3. if ($username == $_GET['usname']) {
  4. ?>
  5. <p> True </p>
  6. <?php
  7. } else {
  8. ?>
  9. <p> False </p>
  10. <?php
  11. }
  12. ?>


Poczytaj sobie o php (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

@powker1: uważaj co piszesz

Ten post edytował Fipaj 6.06.2005, 16:33:57
Go to the top of the page
+Quote Post
-PHP_Newbie-
post
Post #4





Goście







sory za kłopot
  1. <?php
  2.  
  3. $usname = $GET['usname'];
  4. $username = newbie;
  5.  
  6. if (username == usname) {.....
  7.  
  8. ?>


ale teraz proszę o podpowiedź jak mam zrobiż żeby po nieprawidlowym zalogowaniu cofało do dokument1.php po np. 20s
Go to the top of the page
+Quote Post
powker1
post
Post #5





Grupa: Zarejestrowani
Postów: 59
Pomógł: 0
Dołączył: 16.05.2005
Skąd: 3Miasto

Ostrzeżenie: (0%)
-----


Sorrki Flipaj ale źle wpisałem (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif) ... pochopnie (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif) ..

a Ty spróbuj

  1. <?php
  2.  
  3.  
  4. else
  5.  
  6. {header (&#092;"location: dokument1.php\");
  7. exit;};
  8.  
  9.  
  10. ?>


to przekieruje odrazu spowrotem..
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 15:34