PHP,MySQL - 如何正确地将变量传递给链接[重复]

This question already has an answer here:

So what I have is:

$id = $_POST['id'];
$loann = $_POST['loann'];
$dater = $_POST['dater'];
$apaid = $_POST['apaid'];

... and:

$result = mysql_query("UPDATE _loan SET loana='$loann', dater = CONCAT_WS(',', dater,  '$dater' ), apaid = CONCAT_WS(',', apaid , '$apaid' ) WHERE id=$id");

    echo $id;

Everything works fine now the problem shows when I tray to pass the value of $id into:

echo ('<meta http-equiv="refresh" content="1;url=view_details.php?id=$id">');

What I would get in the browser would be:

mysite.net/view_details.php?id=$id

Instead of:

mysite.net/view_details.php?id=133

Any help is greatly appreciated.

</div>

You're using a single-quoted string, which doesn't expand variables. Either use a double-quoted string:

"<meta http-equiv=\"refresh\" content=\"1;url=view_details.php?id=$id\">"

or concatenate the strings:

'<meta http-equiv="refresh" content="1;url=view_details.php?id=' . $id . '">'

Side note: Your code is vulnerable to SQL injection. You should start reading here and here.