Here is my web page, and here is the page I get the error on. I have way too many files to put all of the code here, but I'll display the code for list_all.php and the file that has the functions, registrant.php, and include the complete file set and structure in an attached file.
labFinal.zip (7.44K)
Number of downloads: 16
list_all.php
<?php include 'header.php'; ?> <div id="main"> <div id="content"> <!-- display a table containing users --> <h2>All Users</h2> <table> <tr> <th>First Name</th> <th>Last Name</th> <th>E-mail</th> <th>Gender</th> </tr> <?php foreach ($users as $user) : ?> <tr> <td><?php echo $user->getfirst_name(); ?></td> <td><?php echo $user->getlast_name(); ?></td> <td><?php echo $user->getemail(); ?></td> <td><?php echo $user->getgender($value); ?></td> <td> <form action="index.php" method="get"> <p><input type="hidden" name="action" value="delete" /></p> <p><input type="hidden" name="id" value="<?php echo $user->getuser_id(); ?>" /></p> <p><input type="submit" value="Delete" /></p> </form> </td> </tr> <?php endforeach; ?> </table> <form action="index.php" method="get"> <p><input type="hidden" name="action" value="reset" /></p> <p><input type="submit" value="Add User" /></p> <!-- Visitor = User --> </form> </div><!-- end content --> </div><!-- end main --> <?php include 'footer.php'; ?>
registrant.php
<?php
class Registrant {
const MALE = 'm';
const FEMALE = 'f';
private $user_id, $first_name, $last_name, $email, $gender;
function __construct($user_id, $first_name, $last_name, $email, $gender) {
$this->user_id = $user_id;
$this->first_name = $first_name;
$this->last_name = $last_name;
$this->email = $email;
$this->gender = $gender;
}
public function getuser_id() {
return $this->user_id;
}
public function setuser_id($value) {
$this->user_id = $value;
}
public function getfirst_name() {
return $this->first_name;
}
public function setfirst_name($value) {
return $this->first_name = $value;
}
public function getlast_name() {
return $this->last_name;
}
public function setlast_name($value) {
$this->last_name = $value;
}
public function getemail() {
return $this->email;
}
public function setemail($value) {
return $this->email = $value;
}
public function getgender() {
return $this->gender;
}
public function setgender($value) {
if ($value == self::MALE || $value == self::FEMALE) {
$this->gender = $value;
}
}
}
?>

New Topic/Question
Reply




MultiQuote




|