Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <?php
- require "../auth.php";
- ?>
- <head>
- <meta charset="utf-8">
- <title>Новая услуга</title>
- </head>
- <body>
- <form method="post" action="addservice.php">
- Название услуги:<br>
- <input required type="text" name="service_name"><br>
- Цена:<br>
- <input required type="text" name="service_cost"><br>
- Использованные детали:<br>
- <?php include_once("../dbconnect.php");
- $result = mysql_query(" SELECT * FROM details ");
- mysql_close();
- ?>
- <select name="detail_id" required>
- <?php while($row = mysql_fetch_assoc($result)){ ?>
- <option value="<?php echo $row['detail_id'] ?>" ><?php echo $row['name'] ?></option>
- <?php } ?>
- </select><br>
- <input type="submit" name="add" value="Добавить">
- </form>
- <?php
- include_once("../dbconnect.php");
- if(isset($_POST['add'])){
- $service_name = strip_tags(trim($_POST['service_name']));
- $service_cost = strip_tags(trim($_POST['service_cost']));
- $detail_id = strip_tags(trim($_POST['detail_id']));
- mysql_query(" INSERT INTO services(service_name, service_cost, detail_id)
- VALUES ('$service_name','$service_cost','$detail_id') ");
- mysql_close();
- header("Location: services.php");
- }
- ?>
- <a href="services.php">Вернуться назад</a>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement