Delete using multiple select tag in php

hi im stuck with a delete section in php i want the user to delete single or multiple data using select tag the problem is that it keeps sayin " Undefined index: over in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\projects\svsp\delete.php on line 11" heres the code for remove

<select name="service[]" multiple ="yes"  required="required" >
<option value="<?php echo $service;?>"><?php echo $service;?></option>
<option value="<?php echo $exservice;?>"><?php echo $exservice;?></option>
</select><br><br>
<a href="delete.php" method="post"><button type="submit" class="btn btn-danger" value="submit ">Delete</button></a>
<br>

and this the delete process where the error is generated

<?php
include 'session.php';
if(!isset($_SESSION['login_user']))
{
	header("location:login.php");
}
?>
<?php

$user_check = $_SESSION['login_user'];
$del=$_POST['service'];
$link=mysqli_connect("localhost","root","","sysp");
if($link===false)
{
 die("error cant connect".mysqli_connect_error());
}
if (isset($_POST['submit'])) 
{
$del=$_POST['service'];
}
$change="SELECT  service exservice FROM user WHERE email='$user_check' ";
		$result=mysqli_query($link,$change);
		if(!$result)
{
	echo"no column found";
}
else{
$query = "DELETE  FROM user WHERE  service, exservice='$del'AND email='$user_check'";
$res = mysqli_query($link, $query); // ** actually run the query
			if ($res){echo"Service removed successfully";
} else {
echo"service not removed";
}
}
mysqli_close($link);
?>

I haven’t seen that method of posting a form selection before - using a href .. method="post" rather than a pair of <form> and </form> tags. If you var_dump($_POST) does it show what you would expect?

Neither have I.

Cunfusing method"s" with method ?

methods
The value of this attribute provides information about the functions that might be performed on an object. The values generally are given by the HTTP protocol when it is used, but it might (for similar reasons as for the title attribute) be useful to include advisory information in advance in the link. For example, the browser might choose a different rendering of a link as a function of the methods specified; something that is searchable might get a different icon, or an outside link might render with an indication of leaving the current site. This attribute is not well understood nor supported, even by the defining browser, Internet Explorer 4

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.