Click here to Skip to main content
15,888,069 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i do not understand the undefined index and i cant catch error for delete for instance , 'no checkbox selected' if nothing is selected

What I have tried:

Notice: Undefined index: **num in C:\xampp\htdocs\filename\Event\Event.php on line 80**


HTML
<!doctype html>


<meta charset="utf-8">
<title>Smart Attendance

<?php
	//open connection and select database
	$conn = mysqli_connect("localhost", "root", "","smartattendance_154229N" );
	//Write an SQL statement to extract all events from Event table
	$Event = "SELECT * FROM Event" ;
	
	//Execute the SQL statement
	$EventList= mysqli_query($conn, $Event);
	
	//Write an SQL statement to extract Type from Event table
	$event_query = "SELECT DISTINCT Type FROM event ";
	$Type_list = mysqli_query ($conn, $event_query);
	
	//Write an SQL statement to extract Venue from Event table
	$event_query = "SELECT DISTINCT Venue FROM event ";
	$Venue_list = mysqli_query ($conn, $event_query);
	
	//Write an SQL statement to extract StartTime from Event table
	$event_query = "SELECT DISTINCT StartTime FROM event ";
	$Start_list = mysqli_query ($conn, $event_query);
	
	//Write an SQL statement to extract EndTime from Event table
	$event_query = "SELECT DISTINCT EndTime FROM event ";
	$End_list = mysqli_query ($conn, $event_query);
	
	if (isset ($_POST['register']))
	{
		$event_query = mysqli_query($conn, "SELECT Id FROM event ");
		header("Location:../RegisterEvent/RegisterEvent.php?Id=register");
	}
	
	
	if(isset ($_POST['delete']))
	{
		$box = $_POST['num'];
		while(list ($key,$val) = @each($box))
		{
			mysqli_query($conn,"delete from Event where Id=$val");	
			header("Location:Event.php");		
		}
	}
	
	
	//select checkbox to update
	if(isset ($_POST['edit']))
	{
		$box = $_POST['num'];
		while(list ($key,$val) = @each($box))
		{
			mysqli_query($conn,"Update from Event where Id=$val");	
			header("Location:UpdateEvent.php?edit_id=$val");
		}
	}
?>



<div id="wrapper">
	
<div id="maincontent">
<br>
<h1 align="center">EVENTS</h1>
<br>
        
        <div align="center">
        
        </div>
<br>
		
        
        
        
        
        
        
        
        
        
		
        
				<?php WHILE ($one_Event =  mysqli_fetch_assoc($sql_eventquery)):
				{
				?>
					
                    
    				
                    
                    
                    
                    
    				
                    
                    
                    
  				<?php
				}
				?>
                <?php endwhile;?>
        <table id="myTable" align="center"><tbody><tr style="background-color: black"><th></th><th>Events</th><th>Start Time</th><th>End Time</th><th>Description</th><th>Organization</th><th>Venue</th><th>Type</th><th><br><br>
        </th></tr><tr><td>">Register</td><td><?php echo $one_Event['Name']; ?></td><td><?php echo $one_Event['StartTime']; ?></td><td><?php echo $one_Event['EndTime']; ?></td><td><?php echo $one_Event['Description']; ?></td><td><?php echo $one_Event['Organization']; ?></td><td><?php echo $one_Event['Venue']; ?></td><td><?php echo $one_Event['Type']; ?></td><td>" class="other">
                    </td></tr></tbody></table>
ter>
</div>
</div>

Posted
Updated 16-Apr-17 17:11pm
v2
Comments
Richard MacCutchan 17-Apr-17 4:15am    
Which is line 80?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900