<form method="post" name="date" action="date.php" >
<input class="form-control" type="date" name="delivery_date" value="<?=htmlspecialchars(date('Y-m-d', strtotime($users['delivery_date'])), ENT_QUOTES)?>" id="example-date-input"> <button type="button" class="btn btn-primary btn-xs mb-3">Найти</button>
</form>
<?php
require_once('db.php');
if(isset($_POST['date']))
{
$date = $_POST(['delivery_date']);
$SQL = "SELECT * FROM $dbtable WHERE delivery_date='$date' AND delivery='1' ORDER BY id DESC";
$result = mysqli_query($link, $SQL);
if ($result) {
header('Location:print.php');
}
else {
printf("Ошибка: %s\n", mysqli_error($link));
}
}
?>
<form action="file.php" name="form1" method="post">
<input type="text" name="text">
<input type="submit" value="ok">
<form action="file.php" name="form2" method="post">
<input type="text" name="text">
<input type="submit" value="ok">
<?php
require_once('db.php');
?>
<form method="post" action="">
<input type="date" name="delivery_date">
<input type="submit" value="Найти">
</form>
<?
if(isset($_POST['delivery_date']))
{
$date = $_POST['delivery_date'];
$SQL = "SELECT * FROM $dbtable WHERE delivery_date = '$date' AND delivery = 1";
$result = mysqli_query($link, $SQL);
while ($res = mysqli_fetch_assoc($result))
{
echo $res["user"]." (".$res["delivery_date"].")<br>";
}
}
?>
$date = date('Y-m-d', ['delivery_date'];
Вы должны подставлять не строку, как Вы сейчас делаете, а временную метку.$date = date('Y-m-d', strtotime('delivery_date'));
<?php
$post = get_users();
?>
<?php foreach ($post as $users): ?>
<td><textarea class="form-control" type="text" name="phone" value="" id="example-text-input"><?=htmlspecialchars($users['phone'], ENT_QUOTES)?></textarea></td>
<?php endforeach; ?>
function get_users() {
global $link;
$sql = "SELECT * FROM Users WHERE reject = '0' AND delivery = '0' ORDER BY id DESC";
$result = mysqli_query($link, $sql);
$users = mysqli_fetch_all($result, MYSQLI_ASSOC);
return $users;
}
<?php
require_once('db.php');
if(isset($_POST['delivery_date']))
{
$date = $_POST(['delivery_date']);
$SQL = "SELECT * FROM $dbtable WHERE delivery_date='$date' AND delivery='1' ORDER BY id DESC";
$result = mysqli_query($link, $SQL);
while ($res = mysqli_fetch_assoc($result)) {
printf ("%s\n", $res["delivery_date"]);
}
}
?>
<?php
require_once('db.php');
?>
<form method="post" action="">
<input type="date" name="delivery_date" value="<?=htmlspecialchars(date('Y-m-d', strtotime($users['delivery_date'])), ENT_QUOTES)?>">
<input type="submit" value="Найти">
</form>
<?
if(isset($_POST['delivery_date']))
{
$date = $_POST(['delivery_date']);
$SQL = "SELECT * FROM $dbtable WHERE delivery_date='$date' AND delivery='1' ORDER BY id DESC";
$result = mysqli_query($link, $SQL);
while ($res = mysqli_fetch_assoc($result)) {
printf ("%s\n", $res["delivery_date"]);
}
}
?>
<?php
require_once('db.php'); //подключение вашего файла для работы с бд
?>
//тут рабочая форма, 100%
<form method="post" action="">
<input type="date" name="delivery_date">
<input type="submit" value="Найти">
</form>
<?
if(isset($_POST['delivery_date'])) //проверяем существует ли переменная delivery_date которая должна прийти из формы
{
$date = $_POST(['delivery_date']); //присваиваем значение переменной из формы
$SQL = "SELECT * FROM $dbtable WHERE delivery_date='$date' AND delivery='1' ORDER BY id DESC"; //ваш текст запроса к базе
$result = mysqli_query($link, $SQL); //делаем запрос, видимо переменная линк берется из файла db.php
while ($res = mysqli_fetch_assoc($result)) { // полученный результат от базы преобразуем в асоциативный массив и перебираем в цикле
printf ("%s\n", $res["delivery_date"]); //выводим дату из каждой возвращенной строки массива
} // закрываем цикл
} //закрываем условие
<?php
ini_set('error_reporting', E_ALL); // Включаем вывод всех ошибок
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
require_once('db.php');
if(isset($_POST['delivery_date']))
{
$form_date = $_POST['delivery_date'];
$SQL = "SELECT * FROM $dbtable WHERE delivery_date='$form_date' AND delivery='1' ORDER BY id DESC";
$result = mysqli_query($link, $SQL);
var_dump($result); //смотрим приходит ли что-то по запросу
while ($res = mysqli_fetch_assoc($result)) {
printf ("%s\n", $res["delivery_date"]);
}
}
?>
<?php
//Параметры подключения в БД
$host = "localhost"; //имя хоста
$database = "test1"; //имя базы
$user = "root"; //пользователь
$password = ""; //пароль
$dbtable = "Users"; //таблица
$link = mysqli_connect($host, $user, $password, $database)
or die("Ошибка " . mysqli_error($link));
?>
$SQL = "SELECT comment FROM Users WHERE delivery_date='$form_date' AND delivery='1'";
$result = mysqli_query($link, $SQL);
while ($res = mysqli_fetch_assoc($result)) {
printf ("%s\n", $res["comment"]);
}
<?php
require_once 'functions.php';
?>
<?php
$post = get_delivery_users();
?>
<?php foreach ($post as $users): ?>
<div class="col-lg-12 mt-5">
<div class="card">
<div class="card-body">
<h4 class="header-title">Анкета №<?=$users['id']?> (<?=$users['order_date']?> <?=$users['order_time']?>)</h4>
<form>
<input type="hidden" name="form_id" value="<?=$users['id']?>">
<table class="table text-center">
<thead class="text-uppercase bg-success">
<tr class="text-white">
<th scope="col">Номер</th>
<th scope="col">ФИО</th>
<th scope="col">Доставка</th>
<th scope="col">Дата доставки</th>
<th scope="col">Время доставки</th>
<th scope="col">Сумма</th>
<th scope="col"> </th>
</tr>
</thead>
<tbody>
<tr>
<td><textarea class="form-control" type="text" name="phone" value="" id="example-text-input"><?=htmlspecialchars($users['phone'], ENT_QUOTES)?></textarea></td>
<td><textarea class="form-control" type="text" name="name" value="" id="example-text-input"><?=htmlspecialchars($users['surname'], ENT_QUOTES)?> <?=htmlspecialchars($users['name'], ENT_QUOTES)?> <?=htmlspecialchars($users['second_name'], ENT_QUOTES)?></textarea></td>
<td><div class="form-group">
<select name="delivery_adress" class="form-control">
<? foreach(get_delivery_addresses() as $delivery_address): ?>
<option <?if ($delivery_address == $users['delivery_adress']) echo ' selected'?>><?=htmlspecialchars($delivery_address, ENT_QUOTES)?></option>
<? endforeach;?>
</select>
</div></td>
<td><div class="form-group">
<input class="form-control" type="date" name="delivery_date" value="<?=htmlspecialchars(date('Y-m-d', strtotime($users['delivery_date'])), ENT_QUOTES)?>" id="example-date-input">
</div></td>
<td><div class="form-group">
<textarea class="form-control" type="text" name="delivery_time" value="" id="example-text-input"><?=htmlspecialchars($users['delivery_time'], ENT_QUOTES)?></textarea>
</div></td>
<td><textarea class="form-control" type="text" name="manager_comment" value="" id="example-text-input"><?=htmlspecialchars($users['manager_comment'], ENT_QUOTES)?></textarea></td>
<td><button type="submit" formmethod="post" name="save" formaction="save.php" class="btn btn-rounded btn-warning mb-3">Сохранить</button></td>
</tr>
</tbody>
</table>
</form>
<!-- table primary end -->
<?php endforeach; ?>
function get_delivery_users() {
global $link;
$sql = "SELECT * FROM Users WHERE delivery = '1' ORDER BY id DESC LIMIT 25";
$result = mysqli_query($link, $sql);
$users = mysqli_fetch_all($result, MYSQLI_ASSOC);
return $users;
}
if(isset($_POST['delivery_date']))
{
$form_date = $_POST['delivery_date'];
printf($form_date);
$SQL = "SELECT * FROM Users WHERE delivery_date='$form_date' AND delivery=1";
$result = mysqli_query($link, $SQL);
while ($res = mysqli_fetch_assoc($result)) {
printf ("%s\n", $res["phone"]);
printf ("%s\n", $res["name"]);
printf ("%s\n", $res["surname"]);
printf ("%s\n", $res["second_name"]);
printf ("%s\n", $res["comment"]);
}
}
<?php
require_once('db.php');
$date = $_POST['delivery_date'];
$del = $_POST['del'];
?>
<form method="post" action="">
<input type="date" name="delivery_date" value= "<? echo$date; ?>">
<input type="checkbox" name="del" value=1 checked><br>
<input type="submit" value="Найти">
</form>
<?
if(isset($date))
{
$SQL = "SELECT * FROM $dbtable WHERE delivery_date = '$date' AND delivery = '$del' ORDER BY id DESC";
$result = mysqli_query($link, $SQL);
while ($res = mysqli_fetch_assoc($result))
{
echo $res["user"]." (".$res["delivery_date"].")<br>";
}
}
?>
function get_printed_users()
{
global $link;
if (isset($_POST['delivery_date'])) {
$form_date = $_POST['delivery_date'];
$SQL = "SELECT * FROM Users WHERE delivery_date='$form_date' AND delivery=1";
$result = mysqli_query($link, $SQL);
$users = mysqli_fetch_all($result, MYSQLI_ASSOC);
return $users;
} else {
$sql = "SELECT * FROM Users WHERE delivery = '1' ORDER BY id DESC LIMIT 25";
$result = mysqli_query($link, $sql);
$users = mysqli_fetch_all($result, MYSQLI_ASSOC);
return $users;
}
}
<?php
$post = get_printed_users();
?>
<?php foreach ($post as $users): ?>
<!-- table primary start -->
<div class="col-lg-12 mt-5">
<div class="col-md-6 mt-5">
<div class="card">
<div class="card-body">
<h4 class="header-title">Анкета №: <?=$users['id']?></h4>
<ul class="list-group">
<li class="list-group-item">Имя: <?=htmlspecialchars($users['name'], ENT_QUOTES)?></li>
<li class="list-group-item">Фамилия: <?=htmlspecialchars($users['surname'], ENT_QUOTES)?></li>
<li class="list-group-item">Отчество: <?=htmlspecialchars($users['second_name'], ENT_QUOTES)?></li>
и т.д.