This line isn't working for me:
header("location:landing.php?id=md5($_REQUEST['user'])");
I need to pass the id
variable. How do I do this?
This line isn't working for me:
header("location:landing.php?id=md5($_REQUEST['user'])");
I need to pass the id
variable. How do I do this?
Try
header('location:landing.php?id=' . md5($_REQUEST['user']));
The md5 function shouldn't be in the quotes.
$id = md5($_REQUEST['user']);
header("location: landing.php?id={$id}");
or
header("location: landing.php?id=" . md5($_REQUEST['user']));
The "md5" is being treated as a string in your current code, remove it from the quotes.
Only variable can be parsed into double-quote (ex.: "$id"). Code need to be evaluate first and then you append the result to your string.
header('Location: landing.php?id=' . md5($_REQUEST['user']));
There was also a typo in the way you wrote the header, HTTP header name should starts with a capital letter and there is a space after the ":". I'm not 100% sure it needs to be exactly this way, but it's the standard way to do it.
in php string concateneate using .
operator
It should be
header("location:landing.php?id=".md5($_REQUEST['user']));
!
Note: HTTP/1.1 requires an absolute URI as argument to » Location: including the scheme, hostname and absolute path, but some clients accept relative URIs. You can usually use $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] and dirname() to make an absolute URI from a relative one yourself: