Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6072529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:10:13+00:00 2026-05-23T10:10:13+00:00

I am working on web application(in php),where i require to redirect url with some

  • 0

I am working on web application(in php),where i require to redirect url with some parameter.I have written a code like this

header("Location:http://www.xyz.com?code=2345");

This will redirect to corresponding url but the my data is visible in the browser,i don’t want my data to be visible in the browser.how to hide the data? Is this the secure way of redirection? What is the best way of redirection?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:10:13+00:00Added an answer on May 23, 2026 at 10:10 am

    It’s possible to redirect POST fields that have been sent to the current request (by redirecting with a 307), but to create them artificially is tricky and depends on if the user has javascript enabled. I use this function, but you shouldn’t depend on it working if the user disables javascript.

    <?php
    
    function createHiddenFields( $value, $name = NULL )
    {
        $output = "";
        if( is_array( $value ) ) {
            foreach( $value as $key => $value ) {
                $output .= self::createHiddenFields( $value, is_null( $name ) ? $key : $name."[$key]" );
            }
        } else {
            $output .= sprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\" />",
                htmlspecialchars( stripslashes( $name ) ),
                htmlspecialchars( stripslashes( $value ) )
            );
        }
        return $output;
    }
    
    function redirectNowWithPost( $url, array $post_array = NULL )
    {
        if( is_null( $post_array ) ) { //we want to forward our $_POST fields
            header( "Location: $url", TRUE, 307 );
        } elseif( ! $post_array ) { //we don't have any fields to forward
            header( "Location: $url", TRUE );
        } else { //we have some to forward let's fake a custom post w/ javascript
            ?>
    <form action="<?php echo htmlspecialchars( $url ); ?>" method="post">
    <script type="text/javascript">
    //this is a hack so that the submit function doesn't get overridden by a field called "submit"
    document.forms[0].___submit___ = document.forms[0].submit;
    </script>
    <?php print createHiddenFields( $post_array ); ?>
    </form>
    <script type="text/javascript">
    document.forms[0].___submit___();
    </script>
            <?php
        }
        exit();
    }
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a PHP web application and some times I would like
I have a web application written in PHP. It uses MySQL for data storage.
I'm working on a large PHP (Yii framework) web application where users have accounts
I'm working a web application with PHP. Something wrong is happening that I have
I am working on web application (used PHP, javascript language) , I have provided
The context: I have a web application (e-commerce in few steps) written in php,
I am currently working on a web application that uses PHP and MySQL, but
I'm working profesionally on a php web application which contains contacts, among other data.
I'm currently working on web application using VB in ASP.NET. Right now I have
I am working on a web application using Python (Django) and would like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.