我有具有以下表的HTML文件上:致命錯誤:調用一個成員函數格式()非對象
<form action="wedding-ajax-support.php" method="get" id="wedding-table">
<table border="0"; align="center">
<tr>
<th scope="col">Key</th>
<th scope="col">Value</th>
</tr>
<tr>
<td><label for="date">Select the date on which your party will take place (mm/dd/yyyy): </label></td>
<td>
<input name="date" type="text" class="larger" id="date" size="12" />
</td>
</tr>
<tr>
<td><label for="catering">Type the catering grade you would like (from 1 to 5) : </label></td>
<td><input name="catering" type="text" class="larger" id="catering" size="5" /></td>
</tr>
<tr>
<td><label for="size">Type the number of people you are expecting to attend: </label></td>
<td><input name="size" type="text" class="larger" id="size" size="5" /></td>
</tr>
<tr>
<td>Find me available venues, based on my preferences: </td>
<td><input type="submit" name="submit" id="submit" value="GO!" class="larger" /></td>
</tr>
</table>
One of those inputs is the date. That's the only thing I'm concerned about for now, to keep things simple.
On another file, wedding-ajax-support.php (on which I organize all of my php code) I have this amongst other code:
$date = DateTime::createFromFormat('m/d/Y', $_GET['date']);
$日期= $日期 - >格式( 'YM-d'); //更改日期的格式,如用戶輸入的日期,數據庫中的日期格式不同。
And then a simple echo $date; just to test it.
然後,回到我的主文件,我把
<script type="text/javascript">
$( 「#婚禮表」)負載( 「婚禮Ajax的support.php」)。
在改變後的格式的日期來替換該表中,通過jQuery使用AJAX。
因此,當我加載我的網頁時,應該顯示一條消息 「致命錯誤:調用/ disks/diskh/zco/cotm2中的非對象的成員函數格式()第23行的/public_html/wedding/wedding-ajax-support.php調用堆棧:0.0002 333936 1. {main}()/disks/diskh/zco/cotm2/public_html/wedding/wedding-ajax-support.php:0「 。
Any ideas/suggestions would be appreciated, thanks in advance!
不要使用日期其文本字段的問題,使用日曆(腳本),然後你可以suer的格式。 – 2012-05-24 04:08:58