计算数据并手动插入,具有特定数字的日期

时间:2014-10-13 00:51:42

标签: php mysql

如果我按下ok按钮,它只是刷新我的页面,但没有出现错误,我的错误是什么?我已经通过删除后面的其他部分来调试它,但仍然没有工作..

error_reporting(E_ALL); ini_set('display_errors', 1);
if(isset($_POST['ok']))
{
$udate=date("y-m-d");
$date=date("y-m-d");

$ticket=mysql_query("select count(udate) as ticketcount from tbldate where udate='$udate'",$conn);
if($data=mysql_fetch_array($ticket))
{
$ticketcount=$data['ticketcount'];

if($ticketcount==1)
{
mysql_query("insert into tbldate(udate, date) values('$udate002', '$date')",$conn) or die(mysql_error());
echo "<script>alert('Second Ticket of the day!');</script>";
header('Refresh:0;URL=date.php');
}
else if($ticketcount==2)
{
mysql_query("insert into tbldate(udate, date) values('$udate003', '$date')",$conn) or die(mysql_error());
echo "<script>alert('Third Ticket of the day!');</script>";
header('Refresh:0;URL=date.php');
}
else if($ticketcount==3)
{
mysql_query("insert into tbldate(udate, date) values('$udate004', '$date')",$conn) or die(mysql_error());
echo "<script>alert('Fourth Ticket of the day!');</script>";
header('Refresh:0;URL=date.php');
}
else
{
mysql_query("insert into tbldate(udate, date) values('$udate001', '$date')",$conn) or die(mysql_error());
echo "<script>alert('First Ticket of the day!')</script>";
header('Refresh:0;URL=date.php');
}
}
}
else
{
header('Refresh:0;URL=date.php');
}
?>

这是我的表格

<form action="date_process.php" method="post">
<input type="submit" id="ok" name="SUBMIT">
Date: <input type='text' name='date' size='25'>
</form>

更新。仍然没有工作

1 个答案:

答案 0 :(得分:0)

现在你没有必要改变这个

if(isset($_POST['ok']))

但你必须改变按钮形式

使用此

<button type="submit" name="ok">Send</button>

相反

<input type="submit" id="ok" name="SUBMIT">

它会起作用:)