Answer the question
In order to leave comments, you need to log in
Why is the data not going to the database?
Why is the "status" select data not being passed to the database?
<div class="row">
<form method="POST" action="add_orders.php">
<div class="col-md-4">
<div class="container-form">
<div class="input_class">
<input type="title" name ="title" class="input_text input_form" placeholder="Заголовок">
<input type="name" name ="name" class="input_text input_form" placeholder="Заказчик">
</div>
</div>
</div>
<div class="col-md-4">
<div class="container-form">
<div class="input_class">
<input type="hidden" name="date" class="input_text input_form" value="<?php echo date('Y-m-d') ?>">
</div>
</div>
</div>
<div class="col-md-4">
<div class="container-form">
<div class="input_class">
<input type="text" name="summ" class="input_text input_form" placeholder="Сумма">
<select name="status" class="select_option input_form">
<option value="0">Статус</option>
<option value="1">Завершен</option>
<option value="2">Идут работы</option>
</select>
</div>
</div>
</div>
<input type="submit" name="add" value="Добавить">
</form>
<?php
include("config/config_database.php");
if(isset($_POST['add'])){
$title = strip_tags(trim($_POST['title']));
$name = strip_tags(trim($_POST['name']));
$summ = strip_tags(trim($_POST['summ']));
$status = $_POST['status'];
$date = $_POST['date'];
mysql_query(" INSERT INTO eb_orders(title, name, summ, status, date)
VALUES ('$title', '$name', '$summ', '$status' $date') ");
mysql_close();
echo "News added";
}
?>
</div>
Answer the question
In order to leave comments, you need to log in
This is:
mysql_query(" INSERT INTO eb_orders(title, name, summ, status, date)
VALUES ('$title', '$name', '$summ', '$status' $date')");
Replace with this:
mysql_query(" INSERT INTO eb_orders(title, name, summ, status, date)
VALUES ('$title', '$name', '$summ', '$status', '$date') ") ;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question