hi there! i would like to ask if what am i going to do to save in having multitasking function . here's my code below: can u suggest what to do wih this thing ? thanks
<?php
$server = 'localhost';
$user = 'root';
$password = '';
$database = 'access';
$con = mysql_connect ($server,$user,$password);
$db = mysql_select_db($database);
if (!$db || !$con)
{
die ('<h3>SERVER DOWN BE BACK LATER</h3>');
}
else
{ if (isset ($_POST['search']))
{
$member_id = strtoupper($_POST ['member_id']);
$query = "SELECT * from member_save WHERE member_id like '%$member_id%'";
$result = mysql_query($query);
$records = mysql_fetch_array($result);
/* echo "<table>";
* while($records = mysql_fetch_array($result))
{
echo "<tr>
<td><a href =edit.php?stud_id={$records ['subj_code']}>{$records ['subj_code']}</td>
<td>{$records ['subj_descri']}</td>
<td>{$records ['units']}</td>
</tr>";
}*/
echo "</table>";
}
}
if (isset($_POST['add']))
{
$member_fee= $_POST ['member_fee'];
$mondue= $_POST ['mondue'];
$total= $member_fee+$mondue;
$member_id = strtoupper($_POST ['member_id']);
$lastname = strtoupper($_POST ['lastname']);
$firstname = strtoupper($_POST ['firstname']);
$middlename = strtoupper($_POST ['middlename']);
$semester = strtoupper($_POST ['semester']);
}
if (isset ($_POST['save']))
{
$member_id = strtoupper($_POST ['member_id']);
$lastname= strtoupper($_POST ['lastname']);
$firstname= strtoupper($_POST ['firstname']);
$middlename= strtoupper($_POST ['middlename']);
$semester= strtoupper($_POST ['smester']);
$member_fee= strtoupper($_POST ['member_fee']);
$mondue= strtoupper($_POST ['mondue']);
$total= strtoupper($_POST ['total']);
$date = date("y-m-d");
$time = date("h-m-s");
$query = "INSERT INTO payment
VALUES ( '$member_id',
'$lastname',
'$firstname',
'$middlename',
'$semester',
'$member_fee',
'$mondue',
'$total',
'$date',
'$time')";
if (trim ($member_id)== ''|| trim ($lastname)=='' || trim ($firstname)=='' || trim ($firstname)== '' || trim ($semeser)=='' || trim ($member_fee)== '' || trim ($mondue)=='' || trim ($total)=='')
{
echo "<div ID='message'>PLEASE FILL IN!</div>";
}
else
{
$result = mysql_query($query);
if ($result)
{
echo "<div >SUCCESSFULLY SAVE!</div>";
}
else
{
echo "<div>ERROR!</div>";
}
}
}
?>
<form method="POST" action="">
<table align="center">
<tr>
<th colspan="3">ACCESS FEE</th>
<tr>
<td>Member ID</td>
<td><input type="text" name="member_id" size="10" value="
<?php
if (isset($_POST['search']))
{
echo $records ['member_id'];
}
else if (isset($_POST['add']))
{
echo $member_id;
}
?>
"><input type="submit" name="search" value="Search ID"></td>
</tr>
<tr>
<td>Last Name</td>
<td><input type="text" name="lastname" size="25" value=" <?php
if (isset($_POST['search']))
{
echo $records ['lastname'];
} else if (isset($_POST['add']))
{
echo $lastname;
}
?> "></td>
</tr>
<tr>
<td>First Name</td>
<td><input type="text" name="firstname" size="25" value =" <?php
if (isset($_POST['search']))
{
echo $records ['firstname'];
}
else if (isset($_POST['add']))
{
echo $firstname;
}
?> "></td>
</tr>
<tr>
<td>Middle Name</td>
<td><input type="text" name="middlename" size="25" value =" <?php
if (isset($_POST['search']))
{
echo $records ['middlename'];
}
else if (isset($_POST['add']))
{
echo $middlename;
}
?> "></td>
</tr>
<tr>
<td>Semester</td>
<td><input type="text" name="semester" size="25" value =" <?php
if (isset($_POST['search']))
{
echo $records ['semester'];
}
else if (isset($_POST['add']))
{
echo $semester;
}
?> "></td>
</tr>
<tr>
<td>Membership Fee</td>
<td><input type="text" name="member_fee" size="25" value="
<?php
if (isset($_POST['add']))
{
echo $member_fee;
}
?>
"></td>
</tr>
<tr>
<td>Monthly Due</td>
<td><input type="text" name="mondue" size="25" value="
<?php
if (isset($_POST['add']))
{
echo $mondue;
}
?>
"></td>
</tr>
<tr>
<td>total</td>
<td><input type="text" name="total" value="
<?php if (isset($_POST['add'])){
echo $total;}
?>
" size="25"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="add" value="Add"></td>
</tr>
</table>
<tr>
<td></td>
<td><input type="submit" name="add" value="Save"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="print" value="Print"></td>
</tr>
</form>