0

I am getting the follwoing errors in my PHP and it seems like my post are not set. Any help?
Notice: Undefined index: radio in /home/sajohnson/dynamic_php/editout.php on line 18
Notice: Undefined index: semester in /home/sajohnson/dynamic_php/editout.php on line 19
Notice: Undefined index: dept in /home/sajohnson/dynamic_php/editout.php on line 20
Notice: Undefined index: courseNo in /home/sajohnson/dynamic_php/editout.php on line 21
Notice: Undefined index: semesterHour in /home/sajohnson/dynamic_php/editout.php on line 22
Notice: Undefined index: grade in /home/sajohnson/dynamic_php/editout.php on line 23
Notice: Undefined index: inMajor in /home/sajohnson/dynamic_php/editout.php on line 24

<?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";} 
} 
            


?>

  <h2>Source Code</h2> 
            <?php 
               show_source(__FILE__); 
            ?> 

</body>
</html>
<?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" />
		</p>
</div>
</form>
		<h2>Source Code</h2> 
     			<p> 
        			<?php      
           				show_source(__FILE__); 
        			?> 
    			</p> 

	</body>
</html>
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.