无法从php中的post获取textarea值

无法从php中的post获取textarea值,php,post,textarea,Php,Post,Textarea,Editcontact.php <form method="post" autocomplete="off" action="savecontact.php" id="form" name="form"> <table> <tr> <td>Specific Address in Office</td> <td><textarea name="txtspecificaddress" id="txtspecificaddr

Editcontact.php

<form method="post" autocomplete="off" action="savecontact.php" id="form" name="form">
<table>
<tr>
<td>Specific Address in Office</td>
<td><textarea name="txtspecificaddress" id="txtspecificaddress" rows="4"   cols="50" placeholder="Type specific address within the office. e.g. Room  Number, Section Name or Division Name etc."><?php echo $_SESSION['oldspecificaddress']; ?></textarea></td>
</tr>
</table>
</form>

但它什么也没表现出来。我已经检查了$\u SESSION['oldspecificaddress']的值。有人能帮忙吗?我是PHP新手。

mysqli\u real\u escape\u string()只需要2个参数,而您只传递了1个参数。

用mysqli试试这个:

<?php
$mysqli = new mysqli("localhost", "root", "", "database_name");
if(isset($_POST['txtspecificaddress']))
{   
    $specificaddress = $mysqli->real_escape_string(trim($_POST['txtspecificaddress']));
}
echo $specificaddress;

因为您错误地使用了
mysqli\u real\u escape\u string
。。。请检查手册的外观阅读转义功能手册。如果没有表单更新?您没有提交按钮,那么您如何提交表单?添加
ini\u集('display\u errors',1);ini_集(“日志错误”,1);错误报告(E_全部);mysqli_报告(mysqli_报告错误| mysqli_报告严格)到脚本的顶部。这将强制任何
mysqli\uuuu
错误生成一个您不能错过或忽略的异常。为什么OP要“尝试这个”?一个好的答案总是会有一个解释,说明做了什么以及为什么这样做,不仅是为了OP,而且是为了未来的访客。@JayBlanchard:不,他不是。请仔细核对这个问题。他用的是程序化的方式。哦,我的错,你是对的。我打字时正在看另一个答案。不是我的DV,但是你可以通过向OP展示如何在他们的代码中使用这个函数来获得UV。
<?php
$mysqli = new mysqli("localhost", "root", "", "database_name");
if(isset($_POST['txtspecificaddress']))
{   
    $specificaddress = $mysqli->real_escape_string(trim($_POST['txtspecificaddress']));
}
echo $specificaddress;
if(isset($_POST['txtspecificaddress']))
{   
    $specificaddress = trim($_POST['txtspecificaddress']);
}
echo $specificaddress;