i am not getting this Notice: Undefined index: inMajor in /home/sajohnson/dynamic_php/editout.php on line 24
I have it being posted to the right thing. Any help?
<?php
# editin.php
# Seth Johnson
# Assingment 3
# ITEC 325
# insert or delete data form
?>
<html>
<head><title>Assign 3</title>
</head>
<style type = "text/css">
div.body
{
border-color: red;
border-style: solid;
border-width: 10px;
padding: 15px;
}
p.border
{
border-color: black;
border-style: solid;
border-width: 5px;
padding: 10px;
text-align:center;
}
p.bold
{
font-weight:bold;
text-align:center;
}
</style>
<body>
<div class="body">
<form name = "fm1" id="fm1" action ="./editout.php" method="post">
<p class ="border">PHP file - editin.php<br />data entered here
and processed in editout.php</p>
<p class ="bold">Insert or Delete Data in Your <br />GPA
Database</p>
<table border ="2">
<tr>
<th>
Insert Data
</th>
<td>
<input type ="radio" name ="radio"value ="ins" />
</td>
</tr>
<tr>
<th>
Delete Data
</th>
<td>
<input type ="radio" name="radio" value ="del" />
</td>
</tr>
</table>
<p>Fill out the follwoing fileds and click on the Enter Data
Button</p>
<table border ="2">
<tr>
<th>
Semester (f08)
</th>
<td>
<input type ="text" name="semester"
maxlength="5"size = "5"/>
</tr>
</td>
<tr>
<th>
Dept(ITEC)
</th>
<td>
<input type ="text" name="dept" maxlength="8"size =
"6"/>
</tr>
</td>
<tr>
<th>
Course No.(325)
</th>
<td>
<input type ="text" name="courseNo"maxlength="3"
size = "4"/>
</tr>
</td>
<tr>
<th>
Semester Hours(3)
</th>
<td>
<input type ="text" name="semesterHour"maxlength="4"
size = "5"/>
</tr>
</td>
<tr>
<th>
Grade (A)
</th>
<td>
<input type ="text" name="grade" maxlength="2"size = "3"/>
</tr>
</td>
<tr>
<th>
In-Major (Y or N)
</th>
<td>
<input type ="text" name="inMajor"maxlength="3" size = "4"/>
</td>
</tr>
</table>
<p>
<input type="submit" value="Process DATA and return to
gpaform.php" />
</div>
</form>
</body>
</html>
<?php
# editout.php
# Seth Johnson
# Assingment 3
# ITEC 325
# perform update or insertion and then forward back to graform.php
# where can do another selection
?>
<html>
<head><title>Assignment 3</title></head>
<body>
<?php
//header('Refresh: 1; URL=https://php.radford.edu/~sajohnson/gpaform.php');
//database connection
require('dbconn.php');
$radio = $_POST["radio"];
$sem = $_POST["semester"];
$dept= $_POST["dept"];
$course = $_POST["courseNo"];
$hours = $_POST["semesterHour"];
$grade = $_POST["grade"];
$im = $_POST["inMajor"];
if ($radio == "ins")
{
echo "<h2>Perform Table Insert</h2>";
$query="select * from $table where 'courseNo' ='{$course}'";
$results = mysql_query($query);
//$results = mysql_query($SQLcmd, $conn);
if(mysql_num_row($results)>1)
{
echo 'Course No. already exists';
}
else
{
$SQLcmd = "INSERT INTO $table (semester,dept, courseNo,semesterHour,grade,inMajor) VALUES ('$sem','$dept','$course','$hours','$grade','$im')";
}
// if ($results)
// {
// echo "insert exec";
//}
//else
// {
// echo "insert didn't work";
//}
}
else
{
echo "<h2>Perform Record Delete</h2>";
$sqlcmd = "DELETE FROM $table WHERE courseNo = '$course'";
$results = mysql_query($sqlcmd,$conn);
if ($results)
{echo "it worked<br />";}
else
{echo "NO WORK";}
}
?>
</body>
</html>