hey
i just started learning php programming, i wrote this code, although the HTML code and forms and everything is working but when i click on submit nothing happens.
the code :-
<?php
include("header.html");
include("nav.html");
include("sidebars.html");
?>
<?php
if(isset($_POST['submitted']))
{
if((isset($_POST['name']))&&(isset($_POST['school']))&&(isset($_POST['marks']))&&(isset($_POST['sex'])))
{
if($_POST['marks']>=80)
$grade='A';
else if(($_POST['marks']>=70)&&($_POST['marks']<80))
$grade='B';
else if(($_POST['marks']<70)&&($_POST['marks']>=60))
$grade='C';
else
$grade='D';
echo "<p>".$_POST['name']." of ".$_POST['school']." has scored an average of ".$_POST['marks']." percentage. His/Her grade is :- ".$grade."</p>";
}
}
function calendar()
{
$month=array(1=>"January","February","March","April","May","June","July","August","September","Ocotber","November","December");
$days=range(1,31);
$years=range(1900,2011);
echo "Date of Birth : ";
echo '<select name="month">';
foreach($month as $key=>$value){
echo '<option value='.$key.'">'.$value.'</option>';
}
echo "</select>";
echo '<select name="days">';
foreach($days as $key=>$value){
echo '<option value="'.$key.'">'.$value.'</option>';
}
echo "</select>";
echo '<select name="year">';
foreach($years as $key=>$value){
echo '<option value='.$key.'">'.$value.'</option>';
}
echo '</select>';
echo "<br /><br />";
}
?>
<fieldset>
<legend>Form 1</legend>
<form action="test.php" method="post">
Name : <input type="text" name="name" size="35" /><br /><br />
School : <input type="text" name="school" size="35" /><br /><br />
Avg. Marks : <input type="text" name="avg" size="4"/><br /><br />
Sex : <input type="radio" name="sex" value="m" />Male <input type="radio" name="sex" value="f" />Female<br /><br />
<?php calendar() ?>
<input type="submit" name="submit" value="Submit Form" />
<input type="hidden" name="submitted" value="TRUE" />
</form>
</fieldset>
<?php
include("footer.html");
?>