- Joined
- Jul 26, 2006
- Messages
- 3,626
- Reaction score
- 1,006
The script is simple to the eye, but code is more complicated 
You can extend this even to what the license plate number of him is, it doesn't take too much knowledge to do that, rather to set the basics.
And: http://runeweb.thamob.nl/test2.php
Tell me what u think!
You can extend this even to what the license plate number of him is, it doesn't take too much knowledge to do that, rather to set the basics.
PHP:
<?php
class Human
{
var $First;
var $Name;
var $Middle;
var $Last;
var $Sex;
var $Age;
function Human($first, $middle, $last, $sex, $age)
{
$this->Name = $first;
$this->First = $first;
$this->Middle = $middle;
$this->Last = $last;
$this->Sex = $sex;
$this->Age = $age;
}
function Human_fullName()
{
if (empty($this->Middle))
{
$fullName = $this->First .' '. $this->Last;
} else {
$fullName = $this->First .' '. $this->Middle .' '. $this->Last;
}
return $fullName;
}
function Human_show($name, $sex, $age)
{
$fullName = $this->Human_fullName();
echo '<h3><i>About Me..</i></h3>';
echo '<p>My name is '.$fullName.', you can call me '.$name.' for short.';
echo '<br>';
echo 'I am '.$age.' years old.';
echo '<br>';
echo 'You probably already know due to my name, but I happen to be a '.$sex.'.</p>';
}
function Human_update_show($first, $middle, $last, $sex, $age)
{
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
echo '<table border="0">';
echo '<td>First Name: </td><td><input name="name" value="'.$first.'" type="text" /></td></tr>';
echo '<tr><td>Middle Name: </td><td><input name="mname" value="'.$middle.'" type="text" /></td></tr>';
echo '<tr><td>Last Name: </td><td><input name="lname" value="'.$last.'" type="text" /></td></tr>';
echo '<tr><td>Age: </td><td><input name="age" value="'.$age.'" type="text" /></td></tr>';
echo '<tr><td>Gender: </td>';
echo '<td><select name="sex" selected="'.$sex.'">';
echo '<optgroup label="Gender">';
echo '<option value="Male">Male</option>';
echo '<option value="Female">Female</option>';
echo '</optgroup>';
echo '</select>';
echo '</td></tr>';
echo '<tr><td></td><td><input type="submit" name="create" value="Update Human!" /></td></tr>';
echo '</table>';
echo '</form>';
}
}
if ($_POST['create'])
{
$Human = new Human($_POST['name'], $_POST['mname'], $_POST['lname'], $_POST['sex'], $_POST['age']);
} else {
$Human = new Human('Bob', '', 'Bobkinsons', 'Male', 22);
}
$Human->Human_show($Human->Name, $Human->Sex, $Human->Age);
$Human->Human_update_show($Human->First, $Human->Middle, $Human->Last, $Human->Sex, $Human->Age);
?>
And: http://runeweb.thamob.nl/test2.php
Tell me what u think!

