我想通過PHP更新文本,我可以查詢實際的文本存儲在我的SQL和顯示在輸入框,當我嘗試更新什麼都沒有改變, 我把回聲變量,看它是否工作,我可以閱讀我的數據庫在我的確認頁新的文本,但仍然沒有改變,我盡我直接更新MySQL和它的工作 這裏是我的代碼可以更新我的文本形式到MySQL與PHP
enter code here
<?php
include "../storescripts/connect_to_mysql.php";
// Parse the form data and add inventory item to the system
if (isset($_POST['thisID'])) {
$id = $_POST['thisID'];
$name = 'names';
$textes = $_POST['textes'];
// See if that product name is an identical match to another product in the system
$sql = mysql_query("UPDATE library SET name='$name',textes='$textes'WHERE id='$id");
echo ''.$id.' New text is online, cliquer <a href="inventory_list.php">ici</a>.';
exit();
}
?>
and my form
<form action="text_edit.php" enctype="multipart/form-data" name="myForm" id="myform" method="post">
<table width="90%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td width="20%" align="right">Title</td>
<td width="80%"><label>
<input name="name" type="text" id="name" size="64" value="<?php echo $name; ?>" />
</label></td>
</tr>
</form>
</td>
</tr>
<?php echo ''.$targetID.' ';?>
<tr>
<td align="right">Text</td>
<td><label>
<textarea name="textes" id="textes" cols="64" rows="5"><?php echo $textes; ?> </textarea>
</label></td>
</tr>
<tr>
<td> </td>
<td ><label>
<input name="thisID" type="hidden" value="<?php echo $targetID; ?>" />
<input type="submit" name="button" id="btnsaveedit" value="Save Changes" />
</label>
在查詢中有語法錯誤。另外,如果你的文本包含單引號呢? –
這不是一個我知道的關於安全問題的最終文件,我歪曲了很多代碼,我覺得我要瘋了...只是kiddin – gekim360