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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
<?php
include 'connection.php';
$id_artiste=$_GET["id_artiste"];
$nom_artiste ="";
$prenon ="";
$id_specialite ="";
$reference ="";
$res=mysqli_query($link, "select * from comix_artistes where id_artiste=$id_artiste");
while($row=mysqli_fetch_array($res))
{
$nom_artiste =$row["nom_artiste"];
$prenom =$row["prenom"];
$id_specialite =$row["id_specialite"];
$reference =$row["reference"];
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<link rel="stylesheet" href="css/nouveau.css" type="text/css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>edit artiste</title>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs4/dt-1.10.18/datatables.min.js"></script>
</head>
<body>
<div id="container">
<hr />
<!--ajouter/modifier input--------------->
<div class="input ">
<h2>Artistes</h2><br />
<p class="ajouter_modifier">ajouter/modifier</p><br />
<!---------------------- input form -------------------------------------------->
<div class="fixed">
<form action="" method="post" name="form1">
<div class="form-group"><label for="dog-names"> </label>
<input type="text" name="id_artiste" placeholder="Entrer un id_artiste" value = "<?php echo $id_artiste; ?>" style="width: 200px;">
</div>
<div class="form-group">
<input type="text" name="nom_artiste" placeholder="Entrer un nom_artiste" value = "<?php echo $nom_artiste; ?>" style="width: 200px;">
</div>
<div class="form-group">
<input type="text" name="prenom" placeholder="Entrer un prenom" value = "<?php echo $prenom; ?>" style="width: 200px;">
</div>
<?php
//Liste déroulante specialitées
$sql2 ="SELECT * FROM comix_specialites";
if($result = mysqli_query($link, $sql2)) {
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
//echo $row['id_specialite'];
}
mysqli_free_result($result);
}
else {
echo "Erreur...";
}
}
?>
<?php
echo "<br />";
?>
<div class="form-group">
<select name="id_specialite" style="width: 204px;">
<option value="0">- Aucun -</option>
<?php
$result = mysqli_query($link, "SELECT * from comix_specialites");
while($row = mysqli_fetch_array($result)) {
if($id_specialite == $row['id_specialite']) {
?>
<option value="<?php echo $row['id_specialite'];?> "selected = 'selected'"><?php echo $row["nom_specialite"];?></option>
<?php
}else{
?>
<option value="<?php echo $row['id_specialite'];?>"><?php echo $row["nom_specialite"];?></option>
<?php
}
}
?>
</select>
</div>
<div class="form-group">
<input type="text" name="reference" placeholder="Entrer une reference" value = "<?php echo $reference; ?>" style="width: 200px;">
</div>
<div class="form-group">
<input type="submit" name="update" class="button_edit" value="Mise a jour">
</div>
</form>
</div>
<?php
$categoryName = $row["id_specialite"];
$sql ="SELECT * FROM comix_specialites";
if($result = mysqli_query($link, $sql)) {
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
$dbselected = $row['id_specialite'];
}
//mysqli_free_result($result);
}
}
?>
<br />
<?php
if(isset($_POST["insert"]))
{
mysqli_query($link,"insert into comix_artistes values(NULL,'$_POST[nom_artiste]','$_POST[prenom]','$_POST[id_specialite]','$_POST[reference]')");
}
if(isset($_POST["delete"]))
{
mysqli_query($link,"delete from comix_artistes where id_artiste='$_POST[id_artiste]'") or die(mysqli_error($link));
}
if(isset($_POST["update"]))
{
mysqli_query($link,"update comix_artistes set nom_artiste='$_POST[nom_artiste]', prenom='$_POST[prenom]',id_specialite='$_POST[id_specialite]',reference='$_POST[reference]' where id_artiste=$id_artiste");
?>
<script type="text/javascript">
window.location="artistes_index.php";
</script>
<?php
}
?>
<div class="footer">© 2022 MycomiX - <a href="mentions_legales.html">Mentions légales</a></div> |
Partager