Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require "admin.php";
- ?>
- <?php
- include ('../db.php');
- if(!empty($_POST['save'])) {
- $name = htmlspecialchars($_POST['name']);
- $cat_id = htmlspecialchars($_POST['cat_id']);
- $allcat_id = htmlspecialchars($_POST['allcat_id']);
- $atribute = htmlspecialchars($_POST['atribute']);
- $opis = htmlspecialchars($_POST['opis']);
- $image1 = htmlspecialchars($_POST['image1']);
- $image2 = htmlspecialchars($_POST['image2']);
- $longopis = htmlspecialchars($_POST['longopis']);
- $price = htmlspecialchars($_POST['price']);
- $price1 = htmlspecialchars($_POST['price1']);
- $pric2 = htmlspecialchars($_POST['price2']);
- $madein = htmlspecialchars($_POST['madein']);
- $tov = $_GET['id'];
- $sql = " UPDATE products SET
- name = '$name',
- cat_id = '$cat_id',
- allcat_id = '$allcat_id',
- atribute = '$atribute',
- opis = '$opis',
- image1 = '$image1',
- image2 = '$image2',
- longopis = '$longopis',
- price = '$price',
- price1 = '$price1',
- price2 = '$price2',
- madein = '$madein'
- WHERE id = '$tov'
- ";
- $query = mysqli_query($connection, $sql);
- if ($query) { //если данные отправлены выводим:
- echo 'Запись обновлена';
- }
- else {
- echo 'Ошибка! Запись не обновлена.';
- }
- }
- ?>
- <?php
- include ('../db.php');
- if(isset($_GET['red_id'])){
- $ss = 'SELECT * FROM `products` WHERE `id` = '.$_GET['red_id'];
- $sql = mysqli_query($connection, $ss);
- $result = mysqli_fetch_assoc($sql);
- echo '<form action="red.php?id='.$result['id'].'" method="post">';
- echo'
- <table>
- <tr>
- <td>Наименование</td>
- <td><input type="text" name="name" value="'.$result['name'].'"></td>
- </tr>
- <tr>
- <td>id категории</td>
- <td><input type="number" name="cat_id" value="'.$result['cat_id'].'"></td>
- </tr>
- <tr>
- <td>Общая категория</td>
- <td><input type="number" name="allcat_id" value="'.$result['allcat_id'].'"></td>
- </tr>
- <tr>
- <td>Атрибут</td>
- <td><input type="number" name="atribute" value="'.$result['atribute'].'"></td>
- </tr>
- <tr>
- <td>Фото 1</td>
- <td><input type="file" name="image1" value="'.$result['image1'].'"></td>
- </tr>
- <tr>
- <td>Фото 2</td>
- <td><input type="file" name="image2" value="'.$result['image2'].'"></td>
- </tr>
- <tr>
- <td>Краткое описание продукта</td>
- <td><textarea rows="5" cols="25" type="text" name="opis">
- '.$result['opis'].'</textarea></td>
- </tr>
- <tr>
- <td>Описание продукта</td>
- <td><textarea rows="5" cols="35" type="text" name="longopis">'.$result['longopis'].'</textarea></td>
- </tr>
- <tr>
- <td>Цена</td>
- <td><input type="number" name="price" value="'.$result['price'].'"></td>
- </tr>
- <tr>
- <td>Цена</td>
- <td><input type="number" name="price1" value="'.$result['price1'].'"></td>
- </tr>
- <tr>
- <td>Цена</td>
- <td><input type="number" name="price2" value="'.$result['price2'].'"></td>
- </tr>
- <tr>
- <td>производитель</td>
- <td><input type="text" name="madein" value="'.$result['madein'].'"></td>
- </tr>
- <tr>
- <td><a href=""><input type="submit" name="save" value="Сохранить"> </td>
- </tr>
- </table>
- </form>';
- }
- ?>
- <?php
- /*
- include ('../db.php');
- if (isset($_POST['save'])){
- $name = htmlspecialchars($_POST['name']);
- $cat_id = htmlspecialchars($_POST['cat_id']);
- $allcat_id = htmlspecialchars($_POST['allcat_id']);
- $atribute = htmlspecialchars($_POST['atribute']);
- $opis = htmlspecialchars($_POST['opis']);
- $image1 = htmlspecialchars($_POST['image1']);
- $image2 = htmlspecialchars($_POST['image2']);
- $longopis = htmlspecialchars($_POST['longopis']);
- $price = htmlspecialchars($_POST['price']);
- $price1 = htmlspecialchars($_POST['price1']);
- $pric2 = htmlspecialchars($_POST['pric2']);
- $madein = htmlspecialchars($_POST['madein']);
- $sql = "UPDATE `products` SET
- name = '$name',
- cat_id = '$cat_id',
- allcat_id = '$allcat_id',
- atribute = '$atribute',
- opis = '$opis',
- image1 = '$image1',
- image2 = '$image2',
- longopis = '$longopis',
- price = '$price',
- price1 = '$price1',
- price2 = '$price2',
- madein = '$madein'
- ";
- $query = mysqli_query($connection, $sql);
- if ($query) { //если данные отправлены выводим:
- echo 'Запись обновлена';
- }
- else {
- echo 'Ошибка! Запись не обновлена.';
- }
- }*/
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement