// index.php
<?php
if(isset($_POST['add']))
{
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("bnr");
$sql="insert into idauto values('$id','$name','$email')";
$query=mysql_query($sql);
if($query==true)
{
echo "Registered Successfull";
}
else
{
echo "fail";
}}
/*$result=mysql_query("select id from idauto where name='$name' and email='$email'");
while($row = mysql_fetch_array($result))
{
echo "<br/>Your Id Is:"." ".$row['id'];
}*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post">
<table width="745" border="0" align="center">
<tr>
<td>Id</td>
<td><label for="id"></label>
<input name="id" type="text" disabled="disabled" id="id" /></td>
</tr>
<tr>
<td>Name</td>
<td><label for="name"></label>
<input type="text" name="name" id="name" /></td>
</tr>
<tr>
<td>Email Id</td>
<td><label for="email"></label>
<input type="text" name="email" id="email" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="add" id="save" value="Add" />
</td>
</tr>
</table>
<table border="1" align="left">
<?php
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("bnr");
$sql="select *from idauto";
$query=mysql_query($sql);
while($test = mysql_fetch_array($query))
{
$id = $test['id'];
echo "<tr>";
echo"<td><font color='black'>" .$test['id']."</font></td>";
echo"<td><font color='black'>" .$test['name']."</font></td>";
echo"<td><font color='black'>". $test['email']. "</font></td>";
echo"<td> <a href ='update.php?id=$id'>Edit</a>";
echo"<td> <a href ='delete.php?id=$id'><center>Delete</center></a>";
echo "</tr>";
}
mysql_close($con);
?>
</table>
</form>
</body>
</html>
//savecode.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
//$id=$_REQUEST['id'];
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("bnr");
$sql="insert into idauto values('$id','$name','$email')";
$query=mysql_query($sql);
if($query==true)
{
echo "Registered Successfull";
}
else
{
echo "fail";
}
$result=mysql_query("select id from idauto where name='$name' and email='$email'");
while($row = mysql_fetch_array($result))
{
echo "<br/>Your Id Is:"." ".$row['id'];
}
?>
</body>
</html>
// update.php
<?php
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("bnr");
$id =$_REQUEST['id'];
$result = mysql_query("SELECT * FROM idauto WHERE id = '$id'");
$test = mysql_fetch_array($result);
if (!$result)
{
die("Error: Data not found..");
}
$name=$test['name'] ;
$email= $test['email'] ;
if(isset($_POST['update']))
{
$name_save = $_POST['name'];
$email_save = $_POST['email'];
mysql_query("UPDATE idauto SET name ='$name_save', email ='$email_save' WHERE id = '$id'")
or die(mysql_error());
echo "Saved!";
header("Location: index.php");
}
mysql_close($con);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="274" height="91" border="1" align="center">
<tr>
<td width="72">Id</td>
<td width="186"><label for="id"></label>
<input name="id" type="text" disabled="disabled" id="id" value="<?php echo $id ?>"/></td>
</tr>
<tr>
<td>Name</td>
<td><label for="name"></label>
<input type="text" name="name" id="name" value="<?php echo $name ?>" /></td>
</tr>
<tr>
<td>Email Id`</td>
<td><label for="email"></label>
<input type="text" name="email" id="email" value="<?php echo $email ?>"/></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="update" id="update" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>
//delete.php
<?php
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("bnr");
$id =$_REQUEST['id'];
$result = mysql_query("SELECT * FROM idauto WHERE id = '$id'");
$test = mysql_fetch_array($result);
if (!$result)
{
die("Error: Data not found..");
}
$name=$test['name'] ;
$email= $test['email'] ;
if(isset($_POST['delete']))
{
$id=$_REQUEST['id'];
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("bnr");
$sql="delete from idauto where id='$id'";
$query=mysql_query($sql);
if($query==true)
{ echo "Deleted successfully";
header("Location: index.php");
}
else {
echo "fail"; }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="263" border="1" align="center">
<tr>
<td width="49">Id</td>
<td width="198"><label for="id"></label>
<input name="id" type="text" disabled="disabled" id="id" value="<?php echo $id ?>"/></td>
</tr>
<tr>
<td>Name</td>
<td><label for="name"></label>
<input name="name" type="text" disabled="disabled" id="name" value="<?php echo $name ?>"/></td>
</tr>
<tr>
<td>Email</td>
<td><label for="email"></label>
<input name="email" type="text" disabled="disabled" id="email" value="<?php echo $email ?>"/></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="delete" id="delete" value="Delete" /></td>
</tr>
</table>
</form>
</body>
</html>
<?php
if(isset($_POST['add']))
{
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("bnr");
$sql="insert into idauto values('$id','$name','$email')";
$query=mysql_query($sql);
if($query==true)
{
echo "Registered Successfull";
}
else
{
echo "fail";
}}
/*$result=mysql_query("select id from idauto where name='$name' and email='$email'");
while($row = mysql_fetch_array($result))
{
echo "<br/>Your Id Is:"." ".$row['id'];
}*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post">
<table width="745" border="0" align="center">
<tr>
<td>Id</td>
<td><label for="id"></label>
<input name="id" type="text" disabled="disabled" id="id" /></td>
</tr>
<tr>
<td>Name</td>
<td><label for="name"></label>
<input type="text" name="name" id="name" /></td>
</tr>
<tr>
<td>Email Id</td>
<td><label for="email"></label>
<input type="text" name="email" id="email" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="add" id="save" value="Add" />
</td>
</tr>
</table>
<table border="1" align="left">
<?php
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("bnr");
$sql="select *from idauto";
$query=mysql_query($sql);
while($test = mysql_fetch_array($query))
{
$id = $test['id'];
echo "<tr>";
echo"<td><font color='black'>" .$test['id']."</font></td>";
echo"<td><font color='black'>" .$test['name']."</font></td>";
echo"<td><font color='black'>". $test['email']. "</font></td>";
echo"<td> <a href ='update.php?id=$id'>Edit</a>";
echo"<td> <a href ='delete.php?id=$id'><center>Delete</center></a>";
echo "</tr>";
}
mysql_close($con);
?>
</table>
</form>
</body>
</html>
//savecode.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
//$id=$_REQUEST['id'];
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("bnr");
$sql="insert into idauto values('$id','$name','$email')";
$query=mysql_query($sql);
if($query==true)
{
echo "Registered Successfull";
}
else
{
echo "fail";
}
$result=mysql_query("select id from idauto where name='$name' and email='$email'");
while($row = mysql_fetch_array($result))
{
echo "<br/>Your Id Is:"." ".$row['id'];
}
?>
</body>
</html>
// update.php
<?php
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("bnr");
$id =$_REQUEST['id'];
$result = mysql_query("SELECT * FROM idauto WHERE id = '$id'");
$test = mysql_fetch_array($result);
if (!$result)
{
die("Error: Data not found..");
}
$name=$test['name'] ;
$email= $test['email'] ;
if(isset($_POST['update']))
{
$name_save = $_POST['name'];
$email_save = $_POST['email'];
mysql_query("UPDATE idauto SET name ='$name_save', email ='$email_save' WHERE id = '$id'")
or die(mysql_error());
echo "Saved!";
header("Location: index.php");
}
mysql_close($con);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="274" height="91" border="1" align="center">
<tr>
<td width="72">Id</td>
<td width="186"><label for="id"></label>
<input name="id" type="text" disabled="disabled" id="id" value="<?php echo $id ?>"/></td>
</tr>
<tr>
<td>Name</td>
<td><label for="name"></label>
<input type="text" name="name" id="name" value="<?php echo $name ?>" /></td>
</tr>
<tr>
<td>Email Id`</td>
<td><label for="email"></label>
<input type="text" name="email" id="email" value="<?php echo $email ?>"/></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="update" id="update" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>
//delete.php
<?php
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("bnr");
$id =$_REQUEST['id'];
$result = mysql_query("SELECT * FROM idauto WHERE id = '$id'");
$test = mysql_fetch_array($result);
if (!$result)
{
die("Error: Data not found..");
}
$name=$test['name'] ;
$email= $test['email'] ;
if(isset($_POST['delete']))
{
$id=$_REQUEST['id'];
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("bnr");
$sql="delete from idauto where id='$id'";
$query=mysql_query($sql);
if($query==true)
{ echo "Deleted successfully";
header("Location: index.php");
}
else {
echo "fail"; }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="263" border="1" align="center">
<tr>
<td width="49">Id</td>
<td width="198"><label for="id"></label>
<input name="id" type="text" disabled="disabled" id="id" value="<?php echo $id ?>"/></td>
</tr>
<tr>
<td>Name</td>
<td><label for="name"></label>
<input name="name" type="text" disabled="disabled" id="name" value="<?php echo $name ?>"/></td>
</tr>
<tr>
<td>Email</td>
<td><label for="email"></label>
<input name="email" type="text" disabled="disabled" id="email" value="<?php echo $email ?>"/></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="delete" id="delete" value="Delete" /></td>
</tr>
</table>
</form>
</body>
</html>
No comments:
Post a Comment