如何将输入日期值检索到PHP变量中? [英] How to retrieve the input date value into PHP variable ?

查看:76
本文介绍了如何将输入日期值检索到PHP变量中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从输入类型日期获取值。但我没有得到它的价值。

以下是我的尝试。但问题是我无法获得输入日期的价值



我尝试过:



 

<?php

session_start();

$ link = mysqli_connect('localhost','root','','hoteldetails');

if(isset($ _ POST ['sub']))

{

$ chkInDate = $ _POST ['inDate'];

$ sql =select * from roomdetails CheckIn ='$ chkInDate';

$ sqldata = mysqli_query($ link,$ sql);

while($ row = mysqli_fetch_array($ sqldata)){

//制作表并显示其中的价值

}

}

 











< form method =POSTaction =BookPage.php onsubmit =return validateSearch();> 
< pre>< input type =searchname =searchVal2value =placeholder =eg .Hyderabadid =searchInstyle =border-radius:2px 0 0 2px;>
< input type =submitvalue =Submitname =sub2class =srchbtn>



 < input type =datename =inDatevalue =dd-mm-yyyyid =checkInstyle =border-radius:2px 0 0 2px;> 







<?php

echo $ html;



?>

解决方案

link = mysqli_connect('localhost','root','','hoteldetails');

if(isset(

_POST ['sub']))

{


chkInDate =


I have tried to get the value from input type date. But I am not getting the value of it.
The below is what i tried. But the thing is i ma unable to get the value of input date

What I have tried:

<?php
session_start();
$link = mysqli_connect('localhost','root','','hoteldetails');
if(isset($_POST['sub']))
{
$chkInDate = $_POST['inDate'];
$sql = "select * from roomdetails where CheckIn='$chkInDate';
$sqldata= mysqli_query($link ,$sql);
while($row = mysqli_fetch_array($sqldata)){
//Making a table and displaying values in it
}
}






<form method="POST" action="BookPage.php" onsubmit="return validateSearch();">
<pre><input type="search" name="searchVal2" value=""  placeholder="e.g.Hyderabad" id="searchIn" style="border-radius: 2px 0 0 2px;">
<input type="submit" value="Submit" name="sub2" class="srchbtn">


<input type="date" name="inDate" value="dd-mm-yyyy"  id="checkIn"  style="border-radius: 2px 0 0 2px;">




<?php
echo $html;

?>

解决方案

link = mysqli_connect('localhost','root','','hoteldetails');
if(isset(


_POST['sub']))
{


chkInDate =


这篇关于如何将输入日期值检索到PHP变量中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆