日付ピッカーを備えた Web フォーム。フィールドの 1 つは cdate です。このフィールドには jsdatepick を使用します。
<script type="text/javascript">
window.onload = function(){
new JsDatePick({
useMode:2,
target:"cdate",
dateFormat:"%d-%M-%Y"
};
</script>
<form method="POST" action="insert_record.php">
<tr>
<td style="width: 143px">Call Date:
</td>
<td style="width: 472px">
<input type=text id="cdate" name="cdate" size=40 style="color: black;background-color:#FFFF66; width: 270px;">
</td>
フォーム送信phpは
<?
$cdate=$_POST['cdate'];
$db="call";
$link = mysql_connect("localhost", "sql", "sql");
//$link = mysql_connect("localhost",$_POST['username'],$_POST['password']);
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link) or die("Select Error: ".mysql_error());
$result=mysql_query("INSERT INTO data (cdate) VALUES ('$cdate')")or die("Insert Error: ".mysql_error());
mysql_close($link);
print "Record added\n";
?>
ただし、送信すると、::というメッセージが表示されます
Notice: 未定義のインデックス: d:\web\apache\htdocs\callz\submit_record.php の 4 行目の cdate
this message only occurs in Firefox or Chrome, works fine in any version of IE any ideas? Note there are other variables besides cdate, all of those variables enter into the table without issue, just seems to be the datepick one. I have tried another datepick and this doesn't happen, only with the jsdatepick, but jsdatepick is so much more suitable. Any ideas? thanks