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'])) {
- $about = htmlspecialchars($_POST['about']);
- $phone1 = htmlspecialchars($_POST['phone1']);
- $phone2 = htmlspecialchars($_POST['phone2']);
- $open = htmlspecialchars($_POST['open']);
- $close = htmlspecialchars($_POST['close']);
- $mail = htmlspecialchars($_POST['mail']);
- $sql = " UPDATE contacts SET
- about = '$about',
- phone1 = '$phone1',
- phone2 = '$phone2',
- open = '$open',
- close = '$close',
- mail = '$mail'
- ";
- $query = mysqli_query($connection, $sql);
- if ($query) { //если данные отправлены выводим:
- echo 'Запись обновлена';
- }
- else {
- echo 'Ошибка! Запись не обновлена.';
- }
- }
- ?>
- <form action="contactsred.php" method="post">
- <?php
- include ('../db.php');
- if(isset($_GET['redid_id'])){
- $ss = 'SELECT * FROM `contacts` WHERE `id` = '.$_GET['redid_id'];
- $sql = mysqli_query($connection, $ss);
- $result = mysqli_fetch_assoc($sql);
- echo'
- <table>
- <tr>
- <td>about</td>
- <td><input type="text" name="about" value="'.$result['about'].'"></td>
- </tr>
- <tr>
- <td>phone1</td>
- <td><input type="tel" name="phone1" value="'.$result['phone1'].'"></td>
- </tr>
- <tr>
- <td>phone2</td>
- <td><input type="tel" name="phone2" value="'.$result['phone2'].'"></td>
- </tr>
- <tr>
- <td>open</td>
- <td><input type="time" name="open" value="'.$result['open'].'"></td>
- </tr>
- <tr>
- <td>close</td>
- <td><input type="time" name="close" value="'.$result['close'].'"></td>
- </tr>
- <tr>
- <td>mail</td>
- <td><input type="email" name="mail" value="'.$result['mail'].'"></td>
- </tr>
- <tr>
- <td><input type="submit" name="save" value="Сохранить"> </td>
- </tr>
- </table>
- </form>';
- }
- ?>
Add Comment
Please, Sign In to add comment