Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html><meta charset="utf-8">
- <?php
- /**
- * Created by PhpStorm.
- * User: 455
- * Date: 16.12.2018
- * Time: 20:15
- */
- if(isset($_GET['id'])){
- $id = $_GET['id'];
- $link = mysqli_connect ("localhost" , "root" , "", 'test');
- if($_POST['update'] == true) {
- $name = $_POST['name'];
- $birthdate = $_POST['birthdate'];
- $experience = $_POST['experience'];
- $sql = "UPDATE users SET name='$name', birth_date='$birthdate', experience='$experience' WHERE id=$id";
- if ($link->query($sql) == TRUE) {
- echo '<meta http-equiv="refresh" content="0;index.php">';
- } else {
- echo "Error updating record: " . $link->error;
- }
- }
- $ath = mysqli_query($link, "select * from users where id=$id;");
- $user = mysqli_fetch_array($ath);
- ?>
- <form method="POST" action="edit.php?id=<?=$id?>">
- <input type="hidden" name="update" value="true">
- <label>Имя</label><input type="text" name="name" value="<?=$user['name']?>"><br>
- <label>Дата рождения</label><input type="date" name="birthdate" value="<?=$user['birth_date']?>"><br>
- <label>Опыт</label><input type="text" name="experience" value="<?=$user['experience']?>"><br>
- <button type="submit">Сохранить</button><br>
- </form>
- <?php
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement