hi i need to search a particular record where the user will enter the name or id .
this is my html form
<html>
<fieldset style=text-align:left>
<form name="empdetails" id="empdetails" action="view.php">
ID : <input type="text" id="id" name="id" ><br>
<input type="submit" id="submit" name="view" value="view" ><br>
</form>
</body>
</html>
my php file :
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
$connect=mysql_connect("localhost","root","")or die(mysql_error());
$db_select=mysql_select_db("employee",$connect) or die(mysql_error());
$id=isset($_POST['id']);
$qry="select * from emp where id='$id'";
$result=mysql_query($qry) or die(mysql_error()) ;
while($row=mysql_fetch_array($result))
{
echo "<div> ID ".$row['id'];
echo "<div> NAME" .$row['name'];
echo "<div>GENDER ".$row['gender'];
echo "<div> MOBILE" .$row['mobile'];
echo "<div>MAIL".$row['email'];
}
?>
hiiiiii@
0
Junior Poster in Training
Recommended Answers
Jump to PostSo what seems to be the problem? :) Do you get any errors?
Jump to PostWell, have you checked the value of $id after the form has been submitted and if a record with that $id actually exists?
Checking your code, I notice that you use isset() where you shouldn't actually use it. I have made a couple of changes in your code. Hopefully you'll …
All 7 Replies
minitauros
151
Junior Poster
Featured Poster
hiiiiii@
0
Junior Poster in Training
minitauros
151
Junior Poster
Featured Poster
hiiiiii@
0
Junior Poster in Training
minitauros
151
Junior Poster
Featured Poster
hiiiiii@
0
Junior Poster in Training
minitauros
151
Junior Poster
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.