Help with class error
Posted: Tue Jul 14, 2009 9:12 pm
Hello,
I made this small script to learn the usage of class in php. Can some one please tell me why i am getting this error?
Thank you,
Register.php
PrintNow class
Error that I am getting
I made this small script to learn the usage of class in php. Can some one please tell me why i am getting this error?
Thank you,
Register.php
Code: Select all
<?php
include 'PrintNow.php';
if(isset($_REQUEST['submit'])){
// Get values from user
$firstname = $_REQUEST['firstname'];
$lastname = $_REQUEST['lastname'];
$email = $_REQUEST['email1'];
$re_typedEmail = $_REQUEST['email2'];
$password = $_REQUEST['password1'];
$re_typedPassword = $_REQUEST['password2'];
//Check for null values
if(($firstname == null) || ($firstname == "")){
header("Location: ../index.php?value=firstname");
}elseif(($lastname == null) ||($lastname == "")){
header("Location: ../index.php?value=lastname");
}elseif(($email == null) || ($email == "") ||
($re_typedEmail == null) || ($re_typedEmail == "")){
header("Location: ../index.php?value=email");
}elseif(($password == null)|| ($password == "") ||
($re_typedPassword == null) || ($re_typedPassword == "")){
header("Location: ../index.php?value=password");
}
//Check for Email and Password mismatch
if($email != $re_typedEmail){
header("Location: ../index.php?value=email1");
}elseif($password != $re_typedPassword){
header("Location: ../index.php?value=password1");
}
$printnow = new PrintNow;
$printnow ->printNow($firstname, $lastname);
}else{
header("Location: ../index.php");
}
?>
Code: Select all
<?php
class PrintNow {
public $firstname;
public $lastname;
function printNow($firstname, $lastname){
$this-> firstname = $first;
$this-> lastname = $last;
echo $this-> firstname;
echo "<br>";
echo $this-> lastname;
}
}
?>
Code: Select all
Warning: Missing argument 1 for PrintNow::printNow(), called in C:\xampp\htdocs\register\inc\Register.php on line 33 and defined in C:\xampp\htdocs\register\inc\PrintNow.php on line 8
Warning: Missing argument 2 for PrintNow::printNow(), called in C:\xampp\htdocs\register\inc\Register.php on line 33 and defined in C:\xampp\htdocs\register\inc\PrintNow.php on line 8