please help me the search bar is not searching the table ang giving
results.. pls help me
pls help :( I want to delete multiple records using checkbox and delete
button and also my search I want to search and display firstnames that are
store in the database pls help the delete button configuration is my
problem and idont know why my search bar is not working im new so pls help
me
<html>
<head>
<title>Online Address Book</title>
<LINK REL=StyleSheet href='style1.css' TYPE="text/css" MEDIA=screen>
<style type="text/css">
.new {
background-color: #900;
}
</style>
</head>
<body>
<div id="page">
<div id="mainarea">
<div id="contentarea">
<h2> <?php
session_start();
$user = $_SESSION['username'];
$tag = "<a href = 'edit.php'>EDIT</a>";
echo "<form name='search' method='post' action='display.php'>";
echo "Search Name: <input type='text' name='find' id='find' /> ";
echo "<input type='submit' name='search' value='search' />";
echo "<form method='get'>";
$find = $_REQUEST['find'];
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("phplogin", $con);
$result = mysql_query("SELECT * FROM $user where FirstName like '%$find%'");
$result_rows = mysql_num_rows($result);
while($row = mysql_fetch_array($result))
{
$FirstName[] = $row['FirstName'];
echo $FirstNames[0];
echo "$row[FirstName] <a
href='data.php?edit=$row[FirstName]'>edit</a><br />";
$_name = $row['FirstName'];
echo "Name : <input type='text' name='FirstName' value='$_name'
size='30'>";
while($row = mysql_fetch_array($result))
{
$_name = $row['FirstName'];
}
echo "<h1>Your Contacts</h1>";
echo"</br>";
echo"</br>";
echo"</br>";
echo"<form action= '.$_SERVER[PHP_SELF]' method='POST'>
<p>Search for contacts :
<input type='text' name='Search'>
<input type='submit' value='Search'>";
// display table
$con=mysqli_connect("localhost","root","","phplogin");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM $user ");
$FirstName = mysqli_query($con, "SELECT FirstName FROM $user ");
echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>MobileNumber</th>
<th>HomeNumber</th>
<th>WorkNumber</th>
<th>Email</th>
<th>Address</th>
<th></th>
</tr>";
while($row = mysqli_fetch_assoc($result))
{
echo '
<tr>
<td> '.$row['FirstName'].' </td>
<td> '.$row['LastName'].' </td>
<td> '.$row['MobileNumber'].' </td>
<td> '.$row['HomeNumber'].' </td>
<td> '.$row['WorkNumber'].' </td>
<td> '.$row['Email'].' </td>
<td> '.$row['Address'].' </td>
<td> <input type="checkbox" name="$FirstName[]"
value="'.$row['FirstName'].'" /> . </td>
</tr>
';
}
echo "</table>";
echo "<input type='submit' name 'deletemarked' value='Delete' />";
echo "<input type='submit' name 'editmarked' value='Edit' />";
echo "</form>";
if (isset($_POST['deletemarked']))
{
$impid = implode(", ","$id");
echo $impid;
} echo "</br>";
?> </h2>
</div></div>
<div id="footer"><a href='member.php'> Add New Contact</a></div>
</div>
</body>
</html>
No comments:
Post a Comment