0

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.

George Kagan
  • 5,913
  • 8
  • 46
  • 50
Cluster
  • 65
  • 5

1 Answers1

5

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.

Community
  • 1
  • 1
David
  • 208,112
  • 36
  • 198
  • 279