You misunderstood my question. I know how to code php. I needed advice on how to pass the id up the hiararchy of class. I know that now. I have another question here: ( php 4 )
Code:
<?php
class User{
var $userid;
var $username;
var $firstname;
var $lastname;
var $password;
var $email;
var $signupdate;
var $lastlogin;
var $city;
var $state;
var $zip;
var $registrationstatus;
var $activestatus;
var $forumname;
function User($userId){
$this->userid=$userId;
}
function getFirstName(){
return $this->firstname;
}
}//end class User
//**********************************************
class Trainer extends User{
var $experience;
var $trainerstyle;
var $reasonfortraining;
var $fieldofstudy;
var $degree;
var $yearsofexperience;
var $certifications;
var $educationalbackground;
var $specialization;
var $liabilityinsurance;
var $cpr;
function Trainer($id){
$this->User($id);//passing it to the parent constructor
}
}//end Trainer class
?>
how do I fill the information in those classes. do I need to create another class that will fill out those values for me?
when I code this:
Code:
$Trainer = new Trainer(34);
$Trainer->getFirstName();
$Trainer->getExperience();
the classes are still empty so I get nothing....I need a way to fill out all the values . Should I include a function in teh trainer class that filles out the trainer values and user class that fills out user values in the user class?
Help me out...
Bookmarks