Facing some problem for searching my values in database

I cant understand whats wrong with it. Help me guys. This error showing

Parse error: syntax error, unexpected end of file in E:\xampp\htdocs\studentapp\search.php on line 107

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>



<body>

<br>

<form method="post" action="show.php"><a class="btn btn-info" href="insert.php">Back to Home</a><br><br>
<a class="btn btn-info" href="search.php">Search</a><br><br>
<input type="text" name="search"></form>
</body>
</html>

<?php	
if(isset($_POST['search'])){
if(isset($_GET['go'])){
if(preg_match("/[A-Z | a-z]+/", $_POST['name'])){
    $name=$_POST["name"];
	$fathername=$_POST["fathername"];
	$mothername=$_POST["mothername"];	
   	$address=$_POST["address"];
	$email=$_POST["email"];
	$birthday=$_POST["birthday"];
	$religion=$_POST["religion"];
    $nationality=$_POST["nationality"];
    $gender=$_POST["gender"];
	
	
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "registrationform";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
//sql query
  $sql="SELECT name, fathername,mothername,address,email,birthday,religion,nationality,gender FROM registrationdb WHERE ame LIKE '%" .$name ."%'";
  $result = $conn->query($sql);


//-count results

echo "<table class=table table-info>
<tr>
<th>Id</th>
<th>Name</th>
<th>Fathername</th>
<th>Mothername</th>
<th>Address</th>
<th>Email</th>
<th>Birthday</th>
<th>Religion</th>
<th>Nationality</th>
<th>Gender</th>
<th>Action</th>
</tr>";
foreach($result as $row)
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['fathername'] . "</td>";
echo "<td>" . $row['mothername'] . "</td>";
echo "<td>" . $row['address'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['birthday'] . "</td>";
echo "<td>" . $row['religion'] . "</td>";
echo "<td>" . $row['nationality'] . "</td>";
echo "<td>" . $row['gender'] . "</td>";
echo "<td>" . "<a class='btn btn-warning' href='del.php?id=$row[id]'>Delete</a>" . "<a class='btn btn-success' href='update.php?id=$row[id]'>Update</a>"."</td>";            
echo "</tr>";
}

echo "</table>";
}

$conn->close();



?>

By my quick inaccurate count, the script has 5 opening curly brackets { and only 3 closing ones }
I won’t say exactly where they are missing, due to the lack of proper indenting which makes the job more difficult (that’s your job).

Hint: Proper indenting makes these errors easier to spot and to fix.

still i am not geeting data from database by seraching its shown empty page

Well, it would help to see your corrected code, properly indented.

if(isset($_POST['search'])){
if(isset($_GET['go'])){

Would you normally have both $_POST and $_GET variables present? I can’t see from your html how $_GET['go'] would exist, and as you don’t have an else clause, that would explain a blank page.

This bit confuses me as well

<form method="post" action="show.php"><a class="btn btn-info" href="insert.php">Back to Home</a><br><br>
<a class="btn btn-info" href="search.php">Search</a><br><br> 
<input type="text" name="search"></form>

You have a form tag, with an action field sending it to show.php, but your code is search.php. You have a button that calls search.php as an href, but an input tag in the form that isn’t connected to the button as far as I can see. Is this a newer style of html form coding than I am used to? For me it would be more like

<form method="post" action="search.php">
<input type="text" name="search"> // arrives in code as $_POST['search']
<input type="submit"> // I know there are more modern ways of doing this bit
</form>

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