-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.php
47 lines (37 loc) · 1.2 KB
/
edit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<html lang="es">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css">
<title>EDITAR - Cotizador INTERHOME</title>
</head>
<body>
<div class="content_wrapper">
<?php
include "conexion.php"; // Using database connection file here
$id = $_GET['id']; // get id through query string
$qry = mysqli_query($conn,"select * from cortinas where id='$id'"); // select query
$data = mysqli_fetch_array($qry); // fetch data
if(isset($_POST['update'])) // when click on Update button
{
$valor = $_POST['valor'];
$edit = mysqli_query($conn,"update cortinas set valor='$valor' where id='$id'");
if($edit)
{
mysqli_close($conn);
header("location:editar.php");
exit; // Close connection
}
else
{
echo "no se pudo actualizar";
}
}
?>
<h3>Actualizar valor</h3>
<form method="POST">
Tipo de cortina <?php echo $data['tipo_de_cortina'] ?> a: <input type="text" name="valor" value="<?php echo $data['valor'] ?>" placeholder="Ingrese nuevo valor" Required><br><br>
<input type="submit" name="update" value="Actualizar" class="button">
</form>
</div>
</body>
</html>