Feel free to use my code in your programming projects at school or work. If you have some questions please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
People here in the Philippines can reach me at my mobile number 09173084360.
Thank you very much and Happy Programming.
Sample Program Output
Program Listing
<!-- stud.php -->
<!-- Created By: Mr. Jake R. Pomperada, MAED-IT -->
<!-- December 14, 2012 Thursday -->
<!-- Tool : PHP -->
<html>
<head><title>Student Tuition Fee Solver</title>
<STYLE type="text/css">
h3 {
font-sytle: comic sans ms;
text-align:center;
color: white; /* text color is white */
background: red; /* Content, padding will be blue */
padding: 12px 0px 12px 12px; /* Note 0px padding right */
list-style: none /* no glyphs before a list item */
/* No borders set */
}
</STYLE>
</head>
<?php
error_reporting(0);
$fname = trim($_REQUEST['fname']);
$lname = trim($_REQUEST['lname']);
$gender = strip_tags($_POST['gender']);
$course = trim($_REQUEST['course']);
$units= trim($_REQUEST['units']);
$cost = trim($_REQUEST['cost']);
$paid2 = trim($_REQUEST['paid']);
$paid = number_format($paid2,2,'.',',');
$solve = ($units * $cost);
$total_cost = number_format($solve,2,'.',',');
// Clear the text field
if ($_REQUEST['clear']){
$fname="";
$lname="";
$gender="";
$total_cost="";
$course="";
$units="";
$cost="";
$paid2="";
$paid="";
}
if ($_REQUEST['change']){
$change3 = ($paid2 - $solve);
$change =number_format($change3,2,'.',',');
}
?>
<body bgcolor="green">
<font face="comic sans ms">
<h3>Student Tuition Fee Solver</h3>
<form action="" method="post">
<fieldset>
<table>
<tr><td><font color="white">First Name </font> </td> <td> </td> <td>
<input type="text" name="fname" value="<?php echo $fname; ?> " size="30" /></td>
<td ><font color="white"> Last Name </font> </td> <td> </td> <td >
<input type="text" name="lname" value="<?php echo $lname; ?>" size="30" /></td>
</tr>
<tr><td><font color="white">Gender </font></td> <td> </td> <td>
<font color="white">
Male </font> <input type="radio" value="Male" name="gender" id="gender"
<?php if ($_POST ['gender']=='Male') echo 'checked ="checked"' ; ?> />
<font color="white"> Female </font><input type="radio" value="Female" name="gender" id="gender"
<?php if ($_POST ['gender']=='Female') echo 'checked ="checked"' ; ?> />
</td>
<td> <font color="white"> Course </font> </td> <td> </td>
<td>
<select name="course" id="course">
<option value="Bachelor of Science in Computer Science">
Bachelor of Science in Computer Science</option>
<option value="Bachelor of Science in Information Technology">
Bachelor of Science in Information Technology</option>
<option value="Bachelor of Science in Information System">
Bachelor of Science in Information System </option>
<option value="Bachelor of Science in Information Management">
Bachelor of Science in Information Management </option>
<option value="Bachelor of Science in Software Engineering">
Bachelor of Science in Software Engineering </option>
<option value="Bachelor of Science in Accountancy">
Bachelor of Science in Accountancy </option>
<option value="Bachelor of Science in Management Accounting">
Bachelor of Science in Management Accounting </option>
<option value="Bachelor of Science in Management ">
Bachelor of Science in Management </option>
<option value="Bachelor of Science in Management Accounting">
Bachelor of Science in Management Accounting </option>
<option value="Bachelor of Science in Banking and Finance">
Bachelor of Science in Banking and Finance</option>
<option value="Bachelor of Science in Computer Engineering">
Bachelor of Science in Computer Engineering</option>
<option value="Bachelor of Science in Chemical Engineering">
Bachelor of Science in Chemical Engineering</option>
<option value="Bachelor of Science in Civil Engineering">
Bachelor of Science in Civil Engineering</option>
<option value="Bachelor of Science in Industrial Engineering">
Bachelor of Science in Industrial Engineering</option>
<option value="Bachelor of Science in Nursing">
Bachelor of Science in Nursing</option>
<option value="Bachelor of Science in Pharmacy">
Bachelor of Science in Pharmacy</option>
<option value="Bachelor of Science in Medical Technology">
Bachelor of Science in Medical Technology</option>
</select>
<script type="text/javascript">
document.getElementById('course').value = "<?php echo $_POST['course'];?>";
</script>
</td>
</tr>
<tr><td><font color="white">Number of Units </font> </td> <td> </td> <td>
<input type="text" name="units" value="<?php echo $units; ?> " size="30" /></td>
<td ><font color="white">Cost Per Unit </font></td> <td> </td> <td >
<input type="text" name="cost" value="<?php echo $cost; ?> " size="30" /></td>
</tr>
<tr><td><font color="white">Tuition Fee </font> </td> <td> </td> <td>
<input type="text" name="fee" value="<?php echo $total_cost; ?> " size="30" /></td>
<td ><font color="white">Amount Paid </font> </td> <td> </td> <td >
<input type="text" name="paid" value="<?php echo $paid2; ?> " size="30" /></td>
</tr>
<tr><td><font color="white">Change </font> </td> <td> </td> <td>
<input type="text" name="change2" value="<?php echo $change; ?> " size="30" /></td>
</tr>
<tr><td colspan="2" align="center"><input type="submit" name="compute" value="Solve Tuition"
title="Click here to compute the tuition fee of the student." />
<td colspan="2" align="center"><input type="submit" name="change" value="Solve Change"
title="Click here to compute the payment of the student." />
<td colspan="2" align="center"><input type="submit" name="clear" value="Clear Textbox"
title="Click here to clear the text box." />
</td>
</tr>
<?php
error_reporting(0);
$fname = trim($_REQUEST['fname']);
$lname = trim($_REQUEST['lname']);
$gender = $_POST['gender'];
$course = $_POST['course'];
$units= trim($_REQUEST['units']);
$cost = trim($_REQUEST['cost']);
$paid2 = trim($_REQUEST['paid']);
$paid = number_format($paid2,2,'.',',');
$solve = ($units * $cost);
$total_cost = number_format($solve,2,'.',',');
// Clear the text field
if ($_REQUEST['clear']){
$fname="";
$lname="";
$gender="";
$total_cost="";
$course="";
$units="";
$cost="";
$paid2="";
}
if ($_REQUEST['change']){
$change3 = ($paid2 - $solve);
$change =number_format($change3,2,'.',',');
}
?>
<tr><td><font color="white"> Name : <?php echo ucwords($fname) . " " . ucwords($lname); ?> </font> </td> </tr>
<tr><td><font color="white"> Gender : <?php echo trim($gender) ?> </font> </td> </tr>
<tr><td><font color="white"> Course : <?php echo trim($course) ?> </font> </td> </tr>
<tr><td><font color="white"> No. of Units : <?php echo trim($units) ?> </font> </td> </tr>
<tr><td><font color="white"> Cost Per Unit : $<?php echo trim($cost) ?> </font> </td> </tr>
<tr><td><font color="white"> Tuition Fee : $<?php echo trim($total_cost) ?> </font> </td> </tr>
<tr><td><font color="white"> Amount Paid : $<?php echo trim($paid2) ?> </font> </td> </tr>
<tr><td><font color="white"> Change : $<?php echo trim($change) ?> </font> </td> </tr>
</table>
</fieldset>
</font>
</form>
</body>
</html>