Web Eng PDF
Web Eng PDF
<form method="post">
<b>Name</b>
<input type="text" name="name" />
<br />
<b>Username</b>
<input type="text" name="user" />
<br />
<b>Password</b>
<input type="password" name="pwd" />
<br />
<input type="submit" name="btn" value="INSERT DATA" />
<br />
</form>
<?php
$conn = mysqli_connect("localhost","root","","mcs");
if(isset($_POST["btn"]))
{
$name = $_POST["name"];
$user = $_POST["user"];
$pwd = $_POST["pwd"];
$SQL = "insert into admin(user,pass,name) values('$user','$pwd','$name')";
$res = mysqli_query($conn,$SQL);
if($res > 0)
{
echo '<script>
alert("RECORD ADDED");
window.location.href="insert.php";
</script>';
}
else
{
echo '<script>
alert("ERROR IN QUERY");
window.location.href="insert.php";
</script>';
}
}
?>
DELETE RECORD
<?php
$conn = mysqli_connect("localhost","root","","mcs");
$del = $_GET["aid"];
$SQL = "delete from admin where a_id = '$del' ";
$res = mysqli_query($conn,$SQL);
if($res > 0)
{
echo '<script>
alert("RECORD DELETED");
window.location.href="view.php";
</script>';
}
else
{
echo '<script>
alert("ERROR IN DELETING");
window.location.href="view.php";
</script>';
}
?>
SEARCH RECORD
<?php
$conn = mysqli_connect("localhost","root","","mcs");
$html ="";
if(isset($_POST["btn"]))
{
$name = $_POST["na"];
if(isset($_POST["btn1"]))
{
$user = $_POST["na"];
</form>
<?php
$conn = mysqli_connect("localhost","root","","mcs");
$id = $_GET["aid"];
$SQL = "select * from admin where a_id = '$id'";
$res = mysqli_query($conn,$SQL);
$data = mysqli_fetch_array($res);
if(isset($_POST["btn"]))
{
$name = $_POST["name"];
$user = $_POST["user"];
$pwd = $_POST["pwd"];
$SQL1 = "update admin set name = '$name' ,
user ='$user',
pass= '$pwd'
where a_id = '$id' ";
$res1 = mysqli_query($conn,$SQL1);
if($res1 > 0)
{
echo '<script>
alert("RECORD UPDATED");
window.location.href="view.php";
</script>';
}
else
{
echo '<script>
alert("ERROR IN QUERY");
</script>';
}
}
?>
<form method="post">
<b>Name</b>
<input type="text" name="name" value="<?php echo $data["name"]; ?>" />
<br />
<b>Username</b>
<input type="text" name="user" value="<?php echo $data["user"]; ?>" />
<br />
<b>Password</b>
<input type="password" name="pwd" value="<?php echo $data["pass"]; ?>" />
<br />
<input type="submit" name="btn" value="UPDATE DATA" />
<br />
</form>
VIEW RECORD
<?php
$conn = mysqli_connect("localhost","root","","mcs");
$html ="";
$SQL = "select * from admin";
$res = mysqli_query($conn,$SQL);
if(mysqli_num_rows($res) > 0)
{
while($data = mysqli_fetch_array($res))
{
$pwd = md5($data["pass"]);
$html .= '<tr>
<td>'.$data["name"].'</td>
<td>'.$data["user"].'</td>
<td>'.$data["pass"].'</td>
<td>'.$pwd.'</td>
<td><a href="del.php?aid='.$data["a_id"].'">DELETE</a></td>
<td><a href="update.php?aid='.$data["a_id"].'">UPDATE</a></td>
</tr>';
}
}
else
{
$html = '<tr>
<td colspan="5" bgcolor="red" align="center">
NO RECORD FOUN </td> </tr>';
}
?>
<table align="center" border="2" cellpadding="10" cellspacing="10">
<tr>
<th>NAME</th>
<th>USER</th>
<th>PASSWORD</th>
<th>HIDDEN PASSWORD</th>
<td colspan="2" align="center">
ACTION
</td>
</tr>
<?php
echo $html;
?>
</table>
POWER OF INDEX
<form method="post">
<b>NUMBER</b>
<input type="text" name="num">
<br/>
<b>POWER</b>
<input type="text" name="pwr">
<br/>
<input type="submit" name="btn" value="GET RESULT">
</form>
<?php
if(isset($_POST["btn"]))
$num=$_POST["num"];
$pwr=$_POST["pwr"];
$res=1;
for ($i=1; $i <=$pwr;$i++)
{
$res=$res*$num;
echo $res;
?>