im performing search from the database and displaying the result in the checkbox format in which when i select the checkbox the respectively values should be inserted in the another table which is in (a.php) since the search result have multiple values im storing the values in array but when im trying print the array with echo $_POST['friend']; it showing result as "Array" anyone help me how can i display the variables stored in array
<form method="post">
<div class="form-group">
Name
<br/>
<input type="text" class="form-control" name="name" />
</div>
<div class="form-group">
Email <br/>
<input type="text" class="form-control"name ="email" />
</div>
<div class="form-group">
Qualification<br/>
<input type="text" class="form-control" name ="qualify" />
</div>
<input type="submit" value="Search" />
</form>
<?php
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "myDB";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$name=$_POST['name'];
$email=$_POST['email'];
$qualification=$_POST['qualify'];
$sql = "SELECT * FROM form WHERE Name ='$name' OR EmailAddress = '$email' OR Qualification = '$qualification' ";
$result=$conn->query($sql);
if(!empty($_POST)) {
if($result->num_rows === 0)
{
echo '<p style="margin-left:340px">no records</p>';
}
}
while($row = $result->fetch_assoc())
{
//$_SESSION["snum"]=$row['sno'];
//$_SESSION["nam"]=$row['Name'];
//$_SESSION["quali"]=$row['Qualification'];
// $_SESSION["emai"]=$row['EmailAddress'];
echo '<br>';
echo '<form name="friend" action="a.php" method="post">';
echo '<input style="margin-left:340px;padding-bottom:10px" type="checkbox" name="friend[]"> user Details</input>';
echo '<br>';
echo '<br>';
echo '<div class="container" style="border-style:solid; border-width:medium;width: 550px;">';
echo '<br>';
echo 'Name: '.$row['Name'];
echo '<br /> EmailAddress: ' .$row['EmailAddress'];
echo '<br /> Qualification: '.$row['Qualification'];
echo '<br /> DOB: '.$row['DOB'];
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo '</div>';
echo '<br/>';
}
echo '<button type ="submit">invite</button>';
echo '</form>';
$conn->close();
?>