Judul : HIDDEN CONCEPT USING JAVASCRIPT
link : HIDDEN CONCEPT USING JAVASCRIPT
HIDDEN CONCEPT USING JAVASCRIPT
HIDDEN CONCEPT USING JAVASCRIPT:
======================================================================
First of all create table user & insert 10 values :
SQL>
create table users
(user_id int,
first_name varchar(200),
last_name varchar(200),
user_city varchar(200)
);
(1)WRITE CODE FOR display.php file:
<html>
<head>
<script type="text/javascript">
function update_id(id)
{
if(confirm('do you want to update'))
{
window.location.href='update.php?update_id='+id;
}
}
</script>
<script type="text/javascript">
function delete_id(id)
{
if(confirm('Sure To Remove This Record ?'))
{
window.location.href='delete.php?delete_id='+id;
}
}
</script>
</head>
<body>
<?php
mysql_connect("localhost","root","");
mysql_select_db("ajax");
$sql_query="SELECT * FROM users";
$result_set=mysql_query($sql_query);
?>
<table align="center" >
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>City</th>
<th>Delete</th>
</tr>
<?php
if(mysql_num_rows($result_set)>0)
{
while($row=mysql_fetch_array($result_set))
{
?>
<tr>
<td><?php echo $row['user_id']; ?></td>
<td><?php echo $row['first_name']; ?></td>
<td><?php echo $row['last_name']; ?></td>
<td align="center"><a href="javascript:update_id(<?php echo $row['user_id']; ?>)"><img src="b_drop.png" alt="UPDATE" /></a></td>
<td align="center"><a href="javascript:delete_id(<?php echo $row['user_id']; ?>)"><img src="b_drop.png" alt="Delete" /></a></td>
</tr>
<?php
}
}
else
{
?>
<tr>
<th colspan="4">There's No data found !!!</th>
</tr>
<?php
}
?>
</table>
</body>
</html>
(2)write code for update.php file:
<html>
<head>
<script type="text/javascript">
function finalupdate_id(id)
{
if(confirm('do you want to update'))
{
window.location.href='finalupdate.php?finalupdate_id='+id;
}
}
</script>
</head>
<body>
<?php
if(isset($_GET['update_id']))
{
$hidden=$_GET['update_id'];
$con =mysql_connect("localhost","root","");
mysql_select_db("ajax",$con);
$sql = "select * from users where user_id='$hidden'";
$result = mysql_query($sql);
while($row=mysql_fetch_array($result))
{
echo '<form action="finalupdate.php" method="post">
id <input type="text" name="id" value="'.$row['user_id'].'">
Name <input type="text" name="name" value="'.$row['first_name'].'">
email <input type="text" name="email" value="'.$row['last_name'].'">
password<input type="text" name="password" value="'.$row['user_city'].'">';
?>
<a href="javascript:finalupdate_id(<?php echo $row['user_id']; ?>)"><img src="b_drop.png" alt="finalUPDATE" /></a>
<?php
echo '</form>';
}
}
?>
</body>
</html>
(4)write code for delete.php file:
<?php
if(isset($_GET['delete_id']))
{
echo $_GET['delete_id'];
}
======================================================================
First of all create table user & insert 10 values :
SQL>
create table users
(user_id int,
first_name varchar(200),
last_name varchar(200),
user_city varchar(200)
);
(1)WRITE CODE FOR display.php file:
<html>
<head>
<script type="text/javascript">
function update_id(id)
{
if(confirm('do you want to update'))
{
window.location.href='update.php?update_id='+id;
}
}
</script>
<script type="text/javascript">
function delete_id(id)
{
if(confirm('Sure To Remove This Record ?'))
{
window.location.href='delete.php?delete_id='+id;
}
}
</script>
</head>
<body>
<?php
mysql_connect("localhost","root","");
mysql_select_db("ajax");
$sql_query="SELECT * FROM users";
$result_set=mysql_query($sql_query);
?>
<table align="center" >
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>City</th>
<th>Delete</th>
</tr>
<?php
if(mysql_num_rows($result_set)>0)
{
while($row=mysql_fetch_array($result_set))
{
?>
<tr>
<td><?php echo $row['user_id']; ?></td>
<td><?php echo $row['first_name']; ?></td>
<td><?php echo $row['last_name']; ?></td>
<td align="center"><a href="javascript:update_id(<?php echo $row['user_id']; ?>)"><img src="b_drop.png" alt="UPDATE" /></a></td>
<td align="center"><a href="javascript:delete_id(<?php echo $row['user_id']; ?>)"><img src="b_drop.png" alt="Delete" /></a></td>
</tr>
<?php
}
}
else
{
?>
<tr>
<th colspan="4">There's No data found !!!</th>
</tr>
<?php
}
?>
</table>
</body>
</html>
(2)write code for update.php file:
<html>
<head>
<script type="text/javascript">
function finalupdate_id(id)
{
if(confirm('do you want to update'))
{
window.location.href='finalupdate.php?finalupdate_id='+id;
}
}
</script>
</head>
<body>
<?php
if(isset($_GET['update_id']))
{
$hidden=$_GET['update_id'];
$con =mysql_connect("localhost","root","");
mysql_select_db("ajax",$con);
$sql = "select * from users where user_id='$hidden'";
$result = mysql_query($sql);
while($row=mysql_fetch_array($result))
{
echo '<form action="finalupdate.php" method="post">
id <input type="text" name="id" value="'.$row['user_id'].'">
Name <input type="text" name="name" value="'.$row['first_name'].'">
email <input type="text" name="email" value="'.$row['last_name'].'">
password<input type="text" name="password" value="'.$row['user_city'].'">';
?>
<a href="javascript:finalupdate_id(<?php echo $row['user_id']; ?>)"><img src="b_drop.png" alt="finalUPDATE" /></a>
<?php
echo '</form>';
}
}
?>
</body>
</html>
(3)write code for finalupdate.php file:
<?php
if(isset($_GET['finalupdate_id']))
{
echo $_GET['finalupdate_id'];
}
?>
(4)write code for delete.php file:
<?php
if(isset($_GET['delete_id']))
{
echo $_GET['delete_id'];
}
?>
Demikianlah Artikel HIDDEN CONCEPT USING JAVASCRIPT
Sekianlah artikel HIDDEN CONCEPT USING JAVASCRIPT kali ini, mudah-mudahan bisa memberi manfaat untuk anda semua. baiklah, sampai jumpa di postingan artikel lainnya.
Anda sekarang membaca artikel HIDDEN CONCEPT USING JAVASCRIPT dengan alamat link https://othereffect.blogspot.com/2017/01/hidden-concept-using-javascript.html
0 Response to "HIDDEN CONCEPT USING JAVASCRIPT"
Post a Comment