login  Naam:   Wachtwoord: 
Registreer je!
 Forum

LOGIN

Offline TriX - 14/10/2004 14:38
Avatar van TriXHTML interesse <?php
if($_POST['inloggen'] == "1") {
$gebruikersnaam = $_POST['username'];
$password = $_POST['password'];

if($gebruikersnaam == "a" && $password == "b") {
header("Location: index.php");
} else {
header("Location: index.php");
}

}
?>

Waarom gaat ie daar niet heen als ik inlog??

FORM:

<form name="form1" method="post" action="">
<input type="hidden" name="inloggen" value="1">
<p align="center">Username<br>
<input type="text" name="username">
<br>
Password<br>
<input type="password" name="password">
<br>
<input type="submit" name="Submit" value="Submit">
</p>
</form>

Michel^^

7 antwoorden

Gesponsorde links
Offline robmoorman - 14/10/2004 14:39
Avatar van robmoorman PHP interesse <input type="submit" name="Submit" value="Submit">

moet:

<input type="submit" name="inloggen" value="Submit">
Offline TriX - 14/10/2004 14:41
Avatar van TriX HTML interesse THNX.. zal t ff proberen!

^^
Offline TriX - 14/10/2004 14:45
Avatar van TriX HTML interesse hij logt niet in... er gaat dus iets mis 

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>

<?php
if($_POST['inloggen'] == "1") {
$gebruikersnaam = $_POST['username'];
$password = $_POST['password'];

if($gebruikersnaam == "a" && $password == "b") {
header("Location: fout.html");
} else {
header("Location: fout.html");
}

}
?>
<form name="form1" method="post" action="">
<input type="hidden" name="inloggen" value="1">
<p align="center">Username<br>
<input type="text" name="username">
<br>
Password<br>
<input type="password" name="password">
<br>
<input type="submit" name="inloggen" value="log in">
</p>
</form>

</body>
</html>

Offline BigBug - 14/10/2004 14:48
Avatar van BigBug PHP expert wil je perse submit gebruiken?
<input type="submit" name="Submit" value="Submit"> (deze dus)

verander:
if($_POST['inloggen'] == "1") {

inloggen, naar submit!!:)
Offline TriX - 14/10/2004 14:55
Avatar van TriX HTML interesse Het enige wat ik heb is dit... dan zou die tog naar: fout.html moeten gaan??

Michel

<?php
if($_POST['submit'] == "1") {
$gebruikersnaam = $_POST['username'];
$password = $_POST['password'];

if($gebruikersnaam == "test" && $password == "test") {
header("Location: fout.html");
} else {
header("Location: fout.html");
}

}
?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>

<form name="form1" method="post">
<input type="hidden" name="inloggen" value="1">
<p align="center">Username<br>
<input type="text" name="username">
<br>
Password<br>
<input type="password" name="password">
<br>
<input type="submit" name="submit" value="log in">
</p>
</form>

</body>
</html>
Offline DRUNK - 14/10/2004 14:57
Avatar van DRUNK PHP gevorderde doe het eens zo, if (als) er op $_POST['inloggen'] (je submit knop) geklikt is.
  1. <?php
  2.  
  3. if (isset($_POST['inloggen'])) {
  4. $gebruikersnaam = $_POST['username'];
  5. $password = $_POST['password'];
  6.  
  7. if ($gebruikersnaam == "a" && $password == "b") {
  8. header("Location: fout.html");
  9. }
  10. else {
  11. header("Location: fout.html");
  12. }
  13.  
  14. }
  15. ?>
Offline TriX - 14/10/2004 15:05
Avatar van TriX HTML interesse THNX... hij doet t!

Michel
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2025 Sitemasters.be - Regels - Laadtijd: 0.375s