-1

I have been following this series: https://www.youtube.com/watch?v=hdZuhlQ88e8&list=WL&index=52. I have followed about 4 of his videoes, but at that point nothing really worked.. So I decided to start all over again, and this time i only got this far:

<?php
if($_POST['login'])
{
//get data
$userrname = $_POST['username'];
$password = $_POST['password']; 
}

?>

<form action="login.php" method="POST">
Brukernavn:<br />
<input type="text" name="username"><p />
Passord:<br />
<input type="password" name="password"><p />
<input type="submit" name="login" value="Logg inn">
</form>

I got this error, and I can't figure out why.. "Notice: Undefined index: login in C:\wamp\www\hotellformidling\ny\login2.php on line 3"

Function: {main}( ) Location: ..\login2.php:0

Does anyone have any idea to what I can do? Thanks:)

schou
  • 87
  • 8

2 Answers2

0

first do,

echo var_dump($_POST);

to check $_POST data,then do like below

if(isset($_POST['login']))
Ayyanar G
  • 1,545
  • 1
  • 11
  • 24
0

form action="login.php" method="POST"

In this line as action = "logoin.php", it will search for a file named login.php when you click the submit button. But I suppose, you have named your file login2.php. Change either one of them, so that there is same name on both the places [in form action and your file name].

Prerak Sola
  • 9,517
  • 7
  • 36
  • 67