我正在尝试使用户可以在文本区域中键入文本,然后更新数据库'ptb_profiles'中的mysql表'bio'。
目前他们的信息被拉入这个文本区域,但我想要它,以便他们在其中输入的任何内容都会更新表格。
我正在使用以下代码,但它不起作用?我是 php 和 mysql 的新手,所以它一定是错误的。
任何帮助将非常感激。谢谢。
<?php
//We check if the form has been sent
if(isset($_POST['bio']))
{
$content = $_POST['bio'];
//We remove slashes depending on the configuration
if(get_magic_quotes_gpc())
{
$content = stripslashes($content);
}
//We check if all the fields are filled
if($_POST['bio']!='')
{
$sql = "INSERT INTO ptb_profiles.bio VALUES (NULL, '".$_SESSION['user_id']."', '".$message['bio']."');";
mysql_query($sql, $connection);
echo "<div class=\"infobox-message\">Your Profile Information has been updated..</div>";
}
}
?>
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
<textarea id="bio" rows="10" style="width: 456px;
margin-top:3px;
text-align:left;
margin-left:-2px;
height: 122px;
resize: none;
border: hidden;"><?php echo $profile['bio'] ?> </textarea>
<input type="submit" name="send_button" id="send_button" value="Send">