<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
$con = mysql_connect("localhost:3306", "root", "");
mysql_select_db("dvdclub", $con);
$result = mysql_query("select * from customer");
?>
<form action="update2.php" method="post">
<?php
while($row = mysql_fetch_array($result))
{
?>
<input type="radio" name="c" value="<?php echo $row["id"] ?>" />
<?php
echo $row["fname"] . " " . $row["lname"] . "<br/>";
}
?>
<input type="submit" value="Update Customer"/>
</form>
<?php
mysql_close($con);
?>
</body>
</html>
---------------------------------------
2
----------------------------------------
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
$con = mysql_connect("localhost:3306", "root", "");
mysql_select_db("dvdclub", $con);
if(isset($_POST["c"]))
{
$id = $_POST["c"];
$result = mysql_query("select * from customer where id = '$id' ");
?>
<form action="update3.php" method="GET">
<?php
while($row = mysql_fetch_array($result))
{
?>
ID : <input type="text" name="i" value="<?php echo $id ?>" readonly/>
<br/>
First Name : <input type="text" name="f" value="<?php echo $row["fname"] ?>" />
<br/>
Last Name : <input type="text" name="l" value="<?php echo $row["lname"] ?>" />
<br/>
<?php
}
?>
<input type="submit" value="Update Information"/>
</form>
<?php
}
else
{
echo "you must select a customer";
?>
<meta http-equiv="refresh" content="2; url=update1.php"/>
<?php
}
mysql_close($con);
?>
</body>
</html>
------------------------------------------------
3
------------------------------------------------
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
$con = mysql_connect("localhost:3306", "root", "");
mysql_select_db("dvdclub", $con);
if($_GET["f"] != "" && $_GET["l"] != "")
{
$ii = $_GET["i"];
$ff = $_GET["f"];
$ll = $_GET["l"];
mysql_query("update customer set fname = '$ff', lname = '$ll' where id = '$ii'");
echo "update succesfulll";
?>
<meta http-equiv="refresh" content="2; url=index.php"/>
<?php
}
else
{
echo "Yopu must provide the Customer information";
?>
<meta http-equiv="refresh" content="2; url=update1.php"/>
<?php
}
mysql_close($con);
?>
</body>
</html>
No comments
Post a Comment