Trying to pass a parameter, not working :(

w4rezarena.com

New Member
I am trying to pass a parameter to a php function.But nothing is happening, I mean the code does not pass the paramater in index.php to newPHPClass.phpand is it possible to call a function in the form action?here is my code.index.php\[code\] <?php include '../con_db/connect.php'; ?> <?php include '../class/newPHPClass.php'; ?><form action="index.php" method="post"> <label>Username:</label><input type="text" name="username"/><br/> <label>Password:</label><input type="text" name="password"/><br/> <input type="submit" value="http://stackoverflow.com/questions/12792348/Submit" name="submit"/> </form> <?php if (isset($_POST['submit'])) { $username = $_POST['username']; $password = $_POST['password']; $check = new newPHPClass(); $check->checkLogin($username, $password); } ?>\[/code\]and the class\[code\]include '../con_db/connect.php';class newPHPClass { public function checkLogin($username, $password) { $select = mysql_query('SELECT * FROM users WHERE username = "' . $username . '" AND password = "' . $password . '"'); if (count($select) > 0) { echo "true"; return true; } else { echo "false"; return false; } }\[/code\]
 
Back
Top