Ik heb een script waarmee ik producten kan toevoegen/wijzigen/verwijderen.
Het wijzigen werkt alleen niet goed Ik kan bijvoorbeeld wel de huidige gegevens zien in een form, maar als ik daarin dan iets heb veranderd en op submit klik, dan blijkt er helemaal niets veranderd
Weet iemand misschien waar dit aan ligt?
edit.php:
edit1.php
Het wijzigen werkt alleen niet goed Ik kan bijvoorbeeld wel de huidige gegevens zien in een form, maar als ik daarin dan iets heb veranderd en op submit klik, dan blijkt er helemaal niets veranderd
Weet iemand misschien waar dit aan ligt?
edit.php:
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
| <?php include("inc_connect.php"); $id=$_GET['id']; $query = "select * from inventory where id=$id"; $result = mysql_query($query); $id = mysql_result($result,0,"id"); $product = mysql_result($result,0,"product"); $brand = mysql_result($result,0,"brand"); $brandurl = mysql_result($result,0,"brandUrl"); $quantity = mysql_result($result,0,"quantity"); $price = mysql_result($result,0,"price"); $category = mysql_result($result,0,"category"); $imgurl = mysql_result($result,0,"imgUrl"); $keywords = mysql_result($result,0,"keywords"); $tinyinfo = mysql_result($result,0,"tinyInfo"); $description = mysql_result($result,0,"description"); ?> <html> <head> <title>edit</title> </head> <body> <form method="post" action="edit1.php?id=<?php echo($id); ?>"> Product naam:<br> <input type="text" name="product" value="<?php echo($product); ?>"><br> Merk:<br> <input type="text" name="brand" value="<?php echo($brand); ?>"><br> Website <?php echo($brand); ?>:<br> <input type="text" name="brandUrl" value="<?php echo($brandurl); ?>"><br> Hoeveelheid:<br> <input type="text" name="quantity" value="<?php echo($quantity); ?>"><br> Prijs:<br> <input type="text" name="price" value="<?php echo($price); ?>"><br> Categorie:<br> <select name="category"> <?php include("inc_connect.php"); $resultaat = mysql_query("SELECT DISTINCT category FROM inventory ORDER BY category"); WHILE ($data = mysql_fetch_array($resultaat)) { ?> <option><?php echo $data[category]; ?></option> <?php } ?> </select> <?php include("inc_connect.php"); $resultaat = mysql_query("SELECT DISTINCT(category) FROM inventory ORDER BY category"); WHILE ($data = mysql_fetch_array($resultaat)) { ?> <option value="<?php echo "$data->category"; ?>"><?php echo "$data->category"; ?></option> <?php } ?> </select> <br> Plaatje uploaden:<br> <input type="file" name="imgUrl"><?php echo($imgurl); ?><br> Trefwoorden:<br> <textarea name="keywords" rows="1" cols="30"><?php echo($keywords); ?></textarea><br> Korte omschrijving:<br> <textarea name="tinyInfo" rows="2" cols="30"><?php echo($tinyinfo); ?></textarea><br> Grote omschrijving:<br> <textarea name="description" rows="5" cols="30"><?php echo($description); ?></textarea><br> <input type="submit" value="Wijzigen"> </form> </body> </html> |
edit1.php
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| <?php include("inc_connect.php"); $id=$_get['id']; $product = $_post['product']; $brand = $_post['brand']; $brandurl = $_post['brandUrl']; $quantity = $_post['quantity']; $price = $_post['price']; $category = $_post['category']; $imgurl = $_post['imgUrl']; $keywords = $_post['keywords']; $tinyinfo = $_post['tinyInfo']; $description = $_post['description']; $query = "update inventory set product='$product',brand='$brand', quantity='$quantity', price='$price', category='$category', imgUrl='$imgurl', keywords='$keywords', tinyInfo='$tinyinfo', description='$description' where id=$id"; $result = mysql_query($query); header("Location: overzicht.php") ?> |