所以我正在建立一个网站,并在上面放了一个个人简介。然后在下面是一个编辑按钮,它会将您发送到另一个页面,除了某些内容是可编辑的以外,其他页面看起来几乎相同。
当您单击保存按钮时,我有一部分可以将您发送回另一页,但它被注释掉了,因为无论您单击编辑按钮如何,它都会卡在另一页上。您可以在其中输入文字和内容,只是不会保存文字并正确地将您发送回去。另外,即使现在在我的服务器中,该简历也只显示空白,就像它删除了所有文本一样。
<div class = "profileLeftSideContent" >
<textarea rows="15" cols="40" name="bio" id="bio">
<?php
$get_info = mysqli_query($connection, "SELECT first_name, last_name,
bio FROM users WHERE username = '$username'");
$get_row = mysqli_fetch_assoc($get_info);
$db_firstname = $get_row['first_name'];
$db_last_name = $get_row['last_name'];
$db_bio = $get_row['bio'];
echo $db_bio;
?>
</textarea>
</div>
<form method="post" class="budon" action="" onsubmit="return false">
<input type="submit" name="test" id="test" value="Save"/><br/>
</form>
<?php
$get_info = mysqli_query($connection, "SELECT first_name,
last_name, bio FROM users WHERE username = '$username'");
$get_row = mysqli_fetch_assoc($get_info);
$db_firstname = $get_row['first_name'];
$db_last_name = $get_row['last_name'];
$db_bio = $get_row['bio'];
$clided = "false";
$bio = @$_POST['bio'];
$clunk = "true";
function click(){
$clided = "true";
}
if($clided){
//header("Location: profile.php ");
$info_submit_query = mysqli_query($connection, "UPDATE users
SET bio='$bio' WHERE username = '$username'");
$clided = "false";
}
if(array_key_exists('test',$_POST)){
click();
}
?>
Here is u: $username = mysqli_real_escape_string($connection, $_GET['u']);
This is what click() does: function click(){
$clided = "true";
}
if($clided){
//header("Location: profile.php ");
$info_submit_query = mysqli_query($connection, "UPDATE users SET
bio='$bio' WHERE username = '$username'");
$clided = "false";
}
我希望用户在文本框中键入内容,点击“保存”,然后发送回数据库中包含新生物的其他页面。