Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <center>
- <?php
- function test_input($temp){
- $temp = trim($temp);
- $temp = stripslashes($temp);
- $temp = htmlspecialchars($temp);
- return $temp;
- }
- $servername ="localhost";
- $username = "root";
- $password = "usbw";
- $dbname = "GIP";
- $connect1 = new mysqli($servername, $username, $password, $dbname);
- if($connect1->connect_error)
- {
- die("Connection failed: " . $connnect1->connect_error);
- }
- if(isset($_POST["btnUpdateStick"])) // als op de knop verander gedrukt wordt (van stick)
- {
- //vraag het artikeID op dat je meegeeft in de url
- //maak een nieuwe variabele aan waar je de gestripte waarde uit het gelijknamige veld insteekt.
- $artID=$_GET["ID"];
- $foto2=test_input($_POST["txtFoto"]);
- $naam2=test_input($_POST["txtNaam"]);
- $merk2=test_input($_POST["txtMerk"]);
- $maat2=test_input($_POST["txtMaat"]);
- $materiaal2=test_input($_POST["txtMateriaal"]);
- $prijs2=test_input($_POST["txtPrijs"]);
- $omschrijving1=htmlentities($_POST["txtOmschrijving1"]);
- $omschrijving2=htmlentities($_POST["txtOmschrijving2"]);
- $omschrijving3=htmlentities($_POST["txtOmschrijving3"]);
- //SQL-query UPDATE: overschrijf in de databank de oude waarden met de nieuwe
- $sql = "UPDATE sticks SET Stick_Foto='$foto2', Stick_Naam='$naam2', Stick_Merk='$merk2', Stick_Maat='$maat2', Stick_Materiaal='$materiaal2', Stick_Prijs='$prijs2', Stick_Omschrijving='$omschrijving1', Stick_Omschrijving_EN = '$omschrijving2', Stick_Omschrijving_FR = '$omschrijving3' WHERE Stick_ID='$artID'";
- $qresult = $connect1->query($sql);
- echo $sql;
- header("Location: http://localhost:8080/GIP/webpaginas/stick_admin.php");
- }
- if(isset($_POST["btnUpdateShirt"])) // als op de knop verander gedrukt wordt (van stick)
- {
- //vraag het artikeID op dat je meegeeft in de url
- //maak een nieuwe variabele aan waar je de gestripte waarde uit het gelijknamige veld insteekt.
- $artID=$_GET["ID"];
- $foto2=test_input($_POST["txtFoto"]);
- $naam2=test_input($_POST["txtNaam"]);
- $merk2=test_input($_POST["txtMerk"]);
- $maat2=test_input($_POST["txtMaat"]);
- $materiaal2=test_input($_POST["txtMateriaal"]);
- $prijs2=test_input($_POST["txtPrijs"]);
- $omschrijving1=htmlentities($_POST["txtOmschrijving1"]);
- $omschrijving2=htmlentities($_POST["txtOmschrijving2"]);
- $omschrijving3=htmlentities($_POST["txtOmschrijving3"]);
- //SQL-query UPDATE: overschrijf in de databank de oude waarden met de nieuwe
- $sql = "UPDATE shirts SET Shirt_Foto='$foto2', Shirt_Naam='$naam2', Shirt_Merk='$merk2', Shirt_Maat='$maat2', Shirt_Stof='$materiaal2', Shirt_Prijs='$prijs2', Shirt_Omschrijving='$omschrijving1', Shirt_Omschrijving_EN='$omschrijving2', Shirt_Omschrijving_FR='$omschrijving3' WHERE Shirt_ID='$artID'";
- $qresult = $connect1->query($sql);
- echo $sql;
- header("Location: http://localhost:8080/GIP/webpaginas/shirt_admin.php");
- }
- else{
- header("Location: http://localhost:8080/GIP/webpaginas/home_admin.php");
- }
- $connect1->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement