Forum Moderators: coopster
max annual scholarship per student: 15000.00
max annual tuition/books/fees per: 12000
max annual for housign: 3000
max housing per semester: 1500
max amount for the program over the years: 60000
Do I use simple functions? or?
newsemexpense.php:
<form method="POST" action="postsemexpense.php" onsubmit="return isReady(this)">
<table border="0" width="75%" id="table1">
<tr>
<td width="332"><b>Student:</b></td>
<td><input type="hidden" value="<?php echo $row[fname];?> <?php echo $row[mname];?> <?php echo $row[lname];?>" name="student1" size="53" style="border-style: solid; border-width: 1px"><?php echo $row[fname];?> <?php echo $row[mname];?> <?php echo $row[lname];?></td>
</tr>
<TR>
<td width="332"><b>Student ID#:</b></td>
<td>
<input type="hidden" value="<?php echo $row[id1] ; ?>" name="id1" size="53" style="border-style: solid; border-width: 1px"><?php echo $row[id1] ; ?></td>
</tr>
<tr>
<td width="332"><b>SS #:</b></td>
<td>
<input type="hidden" value="<?php echo $row[ss] ; ?>" name="ss" size="53" style="border-style: solid; border-width: 1px"><?php echo $row[ss] ; ?></td>
</td>
</tr>
<tr>
<td width="332"><b>Year:</b></td>
<td>
<select size="1" name="year1" style="border-style: solid; border-width: 1px">
<option selected value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
</select></td>
</tr>
<tr>
<td width="332"><b>Semester:</b></td>
<td>
<select size="1" name="semester1" style="border-style: solid; border-width: 1px">
<option selected value="Winter Q1">Winter Q1</option>
<option value="Spring Q1">Spring Q1</option>
<option value="Summer Q1">Summer Q1</option>
<option value="Fall Q1">Fall Q1</option>
<option value="MiniMester">MiniMester</option>
<option value="Intercession">Intercession</option>
</select></td>
</tr>
<tr>
<td width="332"><b>Tuition:</b></td>
<td>
<input onkeypress="return handleEnter(this, event)" type="text" name="tuition1" size="53" style="border-style: solid; border-width: 1px"></td>
</tr>
<tr>
<td width="332"><b>Fees:</b></td>
<td>
<input onkeypress="return handleEnter(this, event)" type="text" name="fees1" size="53" style="border-style: solid; border-width: 1px"></td>
</tr>
<tr>
<td width="332"><b>Books/Supplies:</b></td>
<td>
<input onkeypress="return handleEnter(this, event)" type="text" name="books1" size="53" style="border-style: solid; border-width: 1px"></td>
</tr>
<tr>
<td width="332"><b>Housing/Room/Board:</b></td>
<td>
<input onkeypress="return handleEnter(this, event)" type="text" name="housing1" size="53" style="border-style: solid; border-width: 1px"></td>
</tr>
<input type="hidden" name="total1" size="53" style="border-style: solid; border-width: 1px"></td>
</table>
<p><input type="submit" value="Submit" name="B1" style="border-style: solid; border-width: 1px"><input type="reset" value="Reset" name="B2" style="border-style: solid; border-width: 1px"></p>
<input type="hidden" name=user value="">
<input type="hidden" name=dateadded value="<?php echo $today;?>">
</form>
postsemexpense.php:
<?php
session_start();
if (!isset($_SESSION['user']))
{
header("Location: login.php");
}
$total1 = $_POST['tuition1'] + $_POST['fees1'] + $_POST['books1'] + $_POST['housing1'];
$con = mysql_connect("localhost","root","shelbyp51");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("scholar", $con);
$sql="INSERT INTO semester (year1, semester1, tuition1, fees1, books1, housing1, total1, user, student1,ss,id1,dateadded)
VALUES
('$_POST[year1]','$_POST[semester1]','$_POST[tuition1]','$_POST[fees1]','$_POST[books1]','$_POST[housing1]','$total1','$_SESSION[user]', '$_POST[student1]', '$_POST[ss]', '$_POST[id1]','$_POST[dateadded]')";
$sqlhist="INSERT INTO historysem (year1, semester1, tuition1, fees1, books1, housing1, total1, user, student1,ss,id1,dateadded)
VALUES
('$_POST[year1]','$_POST[semester1]','$_POST[tuition1]','$_POST[fees1]','$_POST[books1]','$_POST[housing1]','$total1','$_SESSION[user]', '$_POST[student1]', '$_POST[ss]', '$_POST[id1]','$_POST[dateadded]')";
if (!mysql_query($sql,$con))
{
if (mysql_errno() == 1062)
die('This student already has expenses for this year and semester. Please use the Update Semester Expenses section of this site to make changes.<br><br><center><br><form action=usemstudentsearch.php><input type=submit value="Return to Main Search Form" name=button1 style=border-style: solid; border-width: 1px></form>');
else
{
mysql_query($sqlhist,$con);
echo "Student Semester Expenses Sucessfully Added!";
}
}
mysql_close($con)
?>
PLEASE HELP IF YOU CAN.