I'm trying to learn the object oriented side to php and keep hitting brick walls. One which is probably simply fixed but I can't figure out is why a variable variable passed back from a class function via URL will not echo to my page.
index.php
require_once('db.php');
require 'userclass.php';
$user = new user();
if(isset($_POST['submit'])){
if($user->login($_POST['username'], $_POST['password'])){
echo("poo");
}
}
userclass.php
include('db.php');
session_start();
class User{
public function login($username, $password){
$uname = $username;
$pass = $password;
header("location:index.php?uname=".$uname);
}
}
I think it might be something to do with my if condition logic?
Please point out any othwer stupidities on my part or non-common practices, I'd rather learn as much as possible while I'm at it rather than have just one solution. :)
Thanks!