Jump to content

Recommended Posts

We can redirect a request to another url using something like -
header("Location:./xyz.php");
Now, I want to redirect to xyz.php with some variables to be set in request object. I know one way of doing a redirect to xyz.php?name=value.
But, I don't want all my variables to be visible in address bar.
Any idea abt how to do it??
Link to comment
https://forums.phpfreaks.com/topic/32287-setting-request-object/
Share on other sites

Actually, I want to set these variable in some request object, so that I don't need to unset them on the destination page.
Like in J2EE, there variables can be set in session object or request object, is there any equivalent of J2EE's request object in PHP ??
if you're running on apache, you could use .htaccess and mod rewrite. Instead of xyz.php?name=value, you would send them to value.html.

a quick google search for "htaccess mod rewrite" will give you tons of hits. Here's a good one http://corz.org/serv/tricks/htaccess2.php
One thing you can do:
[code]
<html>
<body onload="document.formname.submit();">
<?php
    echo '<form name="formname" action="yourURL">';
    foreach ($_POST as $formname) {
echo '<input type="hidden" name="' . $formname . '" value="' . addslashes($$formname) . '">';
}
    echo '</form>';
?>
</body></html>
?>[/code]
--that creates a page containing only a form with the value of the currently recieved form fields and then auto submits it to a page of your choice
--the notation '$$formname' is called a variable variable
You can also sent a response code of '307' which is a 'temporary redirect' which redirects the form fields automatically as well.  I've tried it before and it works but unless the persons browser security settings  are low, the browser will pop up a warning box. I forget the actual syntax you use, but it is something like this:
[code]<?php
    header("HTTP/1.0 307 temporary redirect");
    exit;
?>[/code]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.