此代码是一个 html 代表表单上的日期选择器控件,我想获取该值以便将其插入 Mysql DB,我使用 Php
我尝试过类似的方法:$_POST[我不知道这里要包含什么]
提前致谢
<li class="form-line form-line-column" id="id_10">
<label class="form-label-top" id="label_10" for="input_10"> National ID :<span class="form-required">*</span> </label>
<div id="div" class="form-input-wide"><span class="form-sub-label-container">
<input class="form-textbox validate[required]" id="q10_10[day]" name="day1" type="tel" size="2" maxlength="2" value="23" />
<span class="date-separate"> /</span>
<label class="form-sub-label" for="q10_10[day]" id="sublabel_day"> Day </label>
</span><span class="form-sub-label-container">
<input class="form-textbox validate[required]" id="q10_10[month]" name="month1" type="tel" size="2" maxlength="2" value="02" />
<span class="date-separate"> /</span>
<label class="form-sub-label" for="q10_10[month]" id="sublabel_month"> Month </label>
</span><span class="form-sub-label-container">
<input class="form-textbox validate[required]" id="birth_date" name="year1" type="tel" size="4" maxlength="4" value="2013" />
<label class="form-sub-label" for="birth_date" id="sublabel_year"> Year </label>
</span><span class="form-sub-label-container"><img alt="Pick a Date" id="input_10_pick" src="images/calendar.png" align="absmiddle" />
<label class="form-sub-label" for="input_10_pick"> </label>
</span> </div>
</li>
$natdate = date_create(sprintf('%d/%d/%d', $_POST['year1'], $_POST['month1'], $_POST['day1']);
$sql="INSERT INTO memdata(NatDate)
VALUES('$natdate')
当我尝试这个时,我得到解析错误:语法错误,意外';'