Mysql中未插入隐藏字段数据 [英] Hidden field Data is is not inserting in Mysql

查看:50
本文介绍了Mysql中未插入隐藏字段数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 MySQL 表中发送 2 个日期.使用以下代码-

I am trying to send 2 dates in MySQL table. Using following codes-

<table width="1050px"style="border:thin #00F solid"><tr><td>
<?php
$academic_info = getarrayassoc("SELECT * FROM `es_finance_master` ORDER BY `es_finance_masterid` DESC LIMIT 0,1");
$dfrom_acad = strtotime($academic_info['fi_ac_startdate']);
$dto_acad   = strtotime($academic_info['fi_ac_enddate']);
?>
<form  name="form" id="form" action="" method="post" enctype="multipart/form-data">
<table width="1029" cellpadding="2px" cellspacing="0" >
<tr>
<td height="25" colspan="5" class="bgcolor_02">Registration Form <span style="margin-left:500px;">Registration for <?php echo date('Y',$dfrom_acad). " - " . date('Y',$dto_acad) ?> Academic Year</span>
<input type="hidden" name="from_acad" value="<?php $academic_info['fi_ac_startdate']; ?>">
<input type="hidden" name="to_acad" value="<?php $academic_info['fi_ac_enddate']; ?>">
</td>
</tr>
<tr>
<td>Reg. No. :</td>
<td width="330" ><input type="text" name="reg_no" id="reg_no" value="<?php if(isset($_POST['reg_no'])){echo $_POST['reg_no'];} ?>" onblur="reg_check()" />      <div id="reg_err"></div>
</td>
</tr>
</form>
</table>

通过上面的代码我可以看到顶部的年份:但是使用此代码隐藏字段数据不会进入 MySQL

By the above code I can see the Years on top: But hidden fields data are not going to MySQL by using this code

$q2="insert into es_enquiry(eq_from_aca,eq_to_aca,eq_regno) values('".date("Y-m-d",strtotime($_POST['from_acad']))."','".date("Y-m-d",strtotime($_POST['to_acad']))."','".$_POST['reg_no']."')";

我错在哪里

推荐答案

隐藏输出的值没有任何意义,因为您没有使用 echo.

The Values of your hidden outputs are nothing cause you aren't using echo.

试试这个:

value="<?php echo $academic_info['fi_ac_startdate']; ?>"
value="<?php echo $academic_info['fi_ac_enddate']; ?>"

这篇关于Mysql中未插入隐藏字段数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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