Greetings, I'm running a login and I try to show on the screen what I put in my fields, but it throws me the following error.
Notice: Undefined index: password in C: \ xampp \ htdocs \ projects \ maquila \ library \ help \ class.inputfilter.php online 53
My form code is this:
<form role="form" action="<?php url("login/ingresar") ?>" method="post">
<input value="<?php csrf_token() ?>" name="_token" type="hidden">
<fieldset>
<div class="form-group">
<input class="form-control" placeholder="Usuario" name="usuario" type="text" required autocomplete="off" autofocus>
</div>
<div class="form-group">
<input class="form-control" placeholder="Contraseña" name="password" type="password" required>
</div>
<!-- <div class="checkbox">
<label>
<input name="remember" type="checkbox" value="Remember Me">Remember Me
</label>
</div> -->
<!-- Change this to a button or input when using this as a form -->
<button type="submit" href="index.html" class="btn btn-lg btn-success btn-block">Iniciar</button>
</fieldset>
</form>
The code of my function is this:
public function input($name) {
$source = $_REQUEST[$name];
if (is_array($source)) {
foreach($source as $key => $value)
// filter element for XSS and other 'bad' code etc.
if (is_string($value)) $source[$key] = $this->remove($this->decode($value));
return $source;
// clean this string
} else if (is_string($source)) {
// filter source for XSS and other 'bad' code etc.
return $this->remove($this->decode($source));
// return parameter as given
} else return $source;
}
And the echo that I look for is this:
public function ingresar(){
if(val_csrf()){
echo input("usuario");
echo input("password");
}
}
The user shows me well, except the Password field. I do not know what I'll be doing wrong.
regards and thanks in advance.