search
records of user on basis of id and name (but it fetch records of user of admin
who is currently login)
<?php
error_reporting(E_ALL);
include ("menu.php");
?>
<form name="searchform" class="search" method="post" action="search.php">
<label>Search Records</label>
<select id="search" name="search">
<option value="id">Id</option>
<option value="name">Name</option>
</select>
<input type="text" name="searchfield" id="searchfield">
<input type="submit" value="Go" name ="go"/>
<img id="loader" src="./img/loading.gif" style="display:none;"/>
</form><br/><br/>
<?php
if (isset($_REQUEST['go'])) {
$search = $_REQUEST['search'];
$searchfield = $_REQUEST['searchfield'];
$admin_id = $_SESSION['s_admin_id'];
// echo $search;
if ($search == 'id') {
?>
<table border="1">
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Mobile</th>
<th>Country</th>
<th>State</th>
<th>Education</th>
<th>Details</th>
<th>Hobbies</th>
<th>File Name</th>
</tr>
<?php
$data = mysqli_query($con, "select * from sign_up where a_id= '$admin_id' and id ='$searchfield'"); //fectch all records of user who is currently in login and id of record
while ($res = mysqli_fetch_array($data)) {
?>
<tr>
<td><?php echo $res['id']; ?></td>
<td><?php echo $res['name']; ?></td>
<td><?php echo $res['email']; ?></td>
<td><?php echo $res['mobile']; ?></td>
<td><?php echo $res['country']; ?></td>
<td><?php echo $res['state']; ?></td>
<td><?php echo $res['edu_category']; ?></td>
<td><?php echo $res['other_detail']; ?></td>
<td><?php echo $res['hobbies']; ?></td>
<td> <a href = "<?php echo $res['doc_path']; ?>" download target="_blank"> <?= $res['original_doc']; ?></a></td>
</tr>
<?php
}
?>
</table>
<?php
} else {
?>
<table border="1">
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Mobile</th>
<th>Country</th>
<th>State</th>
<th>Education</th>
<th>Details</th>
<th>Hobbies</th>
<th>File Name</th>
</tr>
<?php
$data = mysqli_query($con, "select * from sign_up where a_id= '$admin_id' and name ='$searchfield'"); //fectch all records of user who is currently in login and name match of record
while ($res = mysqli_fetch_array($data)) {
?>
<tr>
<td><?php echo $res['id']; ?></td>
<td><?php echo $res['name']; ?></td>
<td><?php echo $res['email']; ?></td>
<td><?php echo $res['mobile']; ?></td>
<td><?php echo $res['country']; ?></td>
<td><?php echo $res['state']; ?></td>
<td><?php echo $res['edu_category']; ?></td>
<td><?php echo $res['other_detail']; ?></td>
<td><?php echo $res['hobbies']; ?></td>
<td> <a href = "<?php echo $res['doc_path']; ?>" download target="_blank"> <?= $res['original_doc']; ?></a></td>
</tr>
<?php
}
?>
</table><?php
}
}
?>
<?php
error_reporting(E_ALL);
include ("menu.php");
?>
<form name="searchform" class="search" method="post" action="search.php">
<label>Search Records</label>
<select id="search" name="search">
<option value="id">Id</option>
<option value="name">Name</option>
</select>
<input type="text" name="searchfield" id="searchfield">
<input type="submit" value="Go" name ="go"/>
<img id="loader" src="./img/loading.gif" style="display:none;"/>
</form><br/><br/>
<?php
if (isset($_REQUEST['go'])) {
$search = $_REQUEST['search'];
$searchfield = $_REQUEST['searchfield'];
$admin_id = $_SESSION['s_admin_id'];
// echo $search;
if ($search == 'id') {
?>
<table border="1">
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Mobile</th>
<th>Country</th>
<th>State</th>
<th>Education</th>
<th>Details</th>
<th>Hobbies</th>
<th>File Name</th>
</tr>
<?php
$data = mysqli_query($con, "select * from sign_up where a_id= '$admin_id' and id ='$searchfield'"); //fectch all records of user who is currently in login and id of record
while ($res = mysqli_fetch_array($data)) {
?>
<tr>
<td><?php echo $res['id']; ?></td>
<td><?php echo $res['name']; ?></td>
<td><?php echo $res['email']; ?></td>
<td><?php echo $res['mobile']; ?></td>
<td><?php echo $res['country']; ?></td>
<td><?php echo $res['state']; ?></td>
<td><?php echo $res['edu_category']; ?></td>
<td><?php echo $res['other_detail']; ?></td>
<td><?php echo $res['hobbies']; ?></td>
<td> <a href = "<?php echo $res['doc_path']; ?>" download target="_blank"> <?= $res['original_doc']; ?></a></td>
</tr>
<?php
}
?>
</table>
<?php
} else {
?>
<table border="1">
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Mobile</th>
<th>Country</th>
<th>State</th>
<th>Education</th>
<th>Details</th>
<th>Hobbies</th>
<th>File Name</th>
</tr>
<?php
$data = mysqli_query($con, "select * from sign_up where a_id= '$admin_id' and name ='$searchfield'"); //fectch all records of user who is currently in login and name match of record
while ($res = mysqli_fetch_array($data)) {
?>
<tr>
<td><?php echo $res['id']; ?></td>
<td><?php echo $res['name']; ?></td>
<td><?php echo $res['email']; ?></td>
<td><?php echo $res['mobile']; ?></td>
<td><?php echo $res['country']; ?></td>
<td><?php echo $res['state']; ?></td>
<td><?php echo $res['edu_category']; ?></td>
<td><?php echo $res['other_detail']; ?></td>
<td><?php echo $res['hobbies']; ?></td>
<td> <a href = "<?php echo $res['doc_path']; ?>" download target="_blank"> <?= $res['original_doc']; ?></a></td>
</tr>
<?php
}
?>
</table><?php
}
}
?>
php language codes for novices
ReplyDeletephp script Customizable Calendar Class