list(,,,,,,,,,$user, $pass) = explode("\t", $line);
if(trim($user) == $_POST['username'] && trim($pass) == $_POST['password'] )
The message undefined offset 10 , The message undefined offset 9 . the 9 and the 10 is the $user and $pass. How do i fix the error? and does undefined offset means its not being declared or something? and theres alot of ,,,,,,,, is because theres value but i dont need it for this php
undefined offset
in this context means that you are expecting more parameters in your call to list
than are in the array on the right hand of the equation.
You are expecting an array with a length of 11 but explode("\t", $line)
is returning an array of less than 11 values.
You either need to ensure you have the right amount of tab separated values in $line
or pad the output of explode
using array_pad
.
Below is an example of using array_pad
to make sure the array has a length of 11:
list(,,,,,,,,,$user, $pass) = array_pad(explode("\t", $line), 11, null);
If $line
did not contain enough tab separated values then $user
and $pass
would take the value null
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With