我想用用户必须提交的文本更新我的数据库。
如果我按提交它不起作用(错误2):
<form method="post">
<input type="text" name="url" id="text" placeholder=<?php echo $userRow[ 'link']; ?>>
<p>
<input type="submit" value="Submit" name="submit" />
</p>
</form>
&#13;
这是php代码
if (isset($_POST['submit'])) {
if (isset($_POST['url'])) {
$urlpart = '.com';
if (strpos($_POST['link'], $urlpart) !== false) {
$link = $_POST['link'];
$user = $_SESSION['user'];
$query = mysql_query("UPDATE users_steam SET tradelink='$tradelink' WHERE id='$user'");
echo '<script language="javascript">';
echo 'alert("URL updated")';
echo '</script>';
}
else {
echo '<script language="javascript">';
echo 'alert("URL not valid! ERROR 1")';
echo '</script>';
}
}
else {
echo '<script language="javascript">';
echo 'alert("URL not valid! ERROR 2")';
echo '</script>';
}
}