2

This is the code:

header("Location: checkout/transactionCompleted.php?id=".$transactionId);

Then I use $_GET['id'] to get the value. So far so good.

Question: How can I do that by POSTING the variable instead and without using session??

Thanks,

George

6
  • 1
    Build a form, fill it, submit it using JavaScript. No other way Commented Jun 9, 2011 at 22:34
  • Why don't you want to use a session? Commented Jun 9, 2011 at 22:35
  • That's not good practice. The server should normally only respond to a POST with a GET redirect so that you don't have back button and refresh issues. Commented Jun 9, 2011 at 22:39
  • Also, you can use a cookie to store the transaction id as well. Commented Jun 9, 2011 at 22:41
  • @Abdullah Jibaly. Which is not a good solution? using $_SESSION or using $_GET? Commented Jun 9, 2011 at 22:49

2 Answers 2

3
$post_data = 'id='.$transactionId;
$content_length = strlen($post_data);

header('POST checkout/transactionCompleted.php');
header('Host: localhost');
header('Connection: close');
header('Content-type: application/x-www-form-urlencoded');
header('Content-length: ' . $content_length);
header('');
header($post_data);
Sign up to request clarification or add additional context in comments.

Comments

1
$http_request  = "POST $path HTTP/1.0\r\n";
$http_request .= "Host: $host\r\n";
$http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
$http_request .= "Content-Length: " . strlen($req) . "\r\n";
$http_request .= $req;

I think that you have to fill such form, and then send it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.