【发布时间】:2014-05-06 15:10:24
【问题描述】:
未定义变量:timComment。您好,这是我在发送到数据库之前尝试获取变量时遇到的错误。我有 3 张。我的第一个是 timesheet.php(我的 id 为 timComment 的 textarea 是在其中制作的)。我的时间表包括 autocomplete.php,其中我拥有大部分代码、输入、功能以及按钮完成的位置。当我按下完成按钮时,它将插入到我有我的 sql 语法的地方。
这是我制作文本区域的时间表
<div class="header">
Commentaires spéciaux :
</br>
<textarea rows="4" cols="88" id="timComments"> </textarea>
</br>
</br>
</div>
在这里我在 autocomplete.php 中有我的按钮
<input type="submit" name="submit_val" value="Terminé" id="end" />
<input type="hidden" name="data" value="<?php echo $date; ?>" />
<input type="hidden" name="usrUserName" value="<?php echo $usrUserName; ?>" />
<input type="hidden" name="timComments" value="<?php echo $timComments; ?>" />
在这里我试图让我的文本区域发送到数据库中(insert.php)
$timComments = $_POST['timComments'] ;
echo($timComments);
(我知道如何插入数据库,但如果它正确地回显了我的 timcmets,我可以继续。
编辑
这里是我的 sql
// Insertion timesheet le timUserdID, creation de la date, date de la semaine
$req = $bdd->prepare('INSERT INTO timesheets (timUserID,timCreatedDate, timDateStartOfWeek,timComments) VALUES(:usrUserName, CURDATE(),:timDateStartOfWeek,:timComments) ');
$req->execute(array('usrUserName' => $usrUserName,'timDateStartOfWeek' => $timDateStartOfWeek,'timComments' => $timComments,));
这里是我的总代码insert.php和timesheet.php的链接
【问题讨论】: