MySQL 테이블에 2 개의 날짜를 보내려고합니다. 사용 나는 상단에 연도 볼 수 있습니다 위의 코드에 의해 codes-숨겨진 필드 데이터가 MySQL에 삽입되지 않습니다.
<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>
을 다음 그러나 숨겨진 필드 데이터가이 코드
$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']."')";
를 사용하여 MySQL로하지 않을 것은 어디 내 실수
Sidenote : POST에서 직접 삽입하는 것은 좋은 생각이 아닙니다. 그리고 우연히'mysql_ * '을 사용한다면 그것은 또 다른 실수입니다. –
또한 (숨겨진) 입력을 echo 할 필요가 있습니다. php echo $ academic_info [ 'fi_ac_startdate']; ?>와' php echo $ academic_info [ 'fi_ac_enddate']; ?> '비록 그들이 숨겨져 있지만, 그들은 여전히 echo'ed해야합니다. 아마도 그럴 것입니다. –