how to pass data to linked page ???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vishal

    how to pass data to linked page ???

    when a user clicks on a hyperlink i want to pass data to linked page.
    but what i want is that this data should not be visible to user. i mean
    is there any way that i can pass data except get method when user click
    on hyper link???


    thxs

  • Jean-Baptiste Nizet

    #2
    Re: how to pass data to linked page ???

    Short answer: no.

    Long answer:
    Why would you want to hide data sent to your application? Any
    half-baked hacker could sniff all the traffic between the browser and
    the server or analyse your HTML code without any problem.
    It seems to me that you want to implement security through obscurity,
    which never works and is always a bad idea (from a security perspective
    and a usability perspective).
    You should always validate the data sent from the browser at
    server-side, and implement your security checks at server-side as well.

    Comment

    • rovisoft

      #3
      re:how to pass data to linked page ???

      You can simulate the click as a form submit, you can make a form with
      hidden fields, and instead of the submit button you add a javascript
      code in the link tag<a href='link.html '
      onclick="this.s ubmit()">Submit Link</a>, you can pass the
      variables using POST method!

      Ovidiu
      http://www.DevPlug.com -- Connecting Developers

      Comment

      • NC

        #4
        Re: how to pass data to linked page ???

        vishal wrote:[color=blue]
        >
        > when a user clicks on a hyperlink i want to pass data
        > to linked page. but what i want is that this data should
        > not be visible to user. i mean is there any way that i
        > can pass data except get method when user click on hyper
        > link???[/color]

        Yes. If the client supports cookies, you can use session
        variables. In the first script, you can write:

        session_start() ;
        $_SESSION['foo'] = 'bar';
        echo '<a href="next.php" >Next Page</a>';

        In the next.php, you can do:

        session_start() ;
        echo $_SESSION['foo'];

        An alternative solution would be to output a hidden form
        anywhere on the page and use JavaScript to submit it when
        the user clicks on a hyperlink:

        <form name="hiddenFor m" method="POST" action="next.ph p">
        <input type="hidden" name="foo" value="bar">
        </form>

        <a href="#" onClick='docume nt."hiddenForm" .submit()'>Next Page</a>

        Cheers,
        NC

        Comment

        • vishal

          #5
          Re: how to pass data to linked page ???

          but if the javascript is not supported or diabled on client machine
          then the above will not work and i am working on a site which is going
          to be accessed by millions of people so may be there are many users on
          whose computer the javascript is disabled or not supported.

          if any other solution without using javascript then let me know

          anyway thxs for your reply....

          Comment

          • vishal

            #6
            Re: how to pass data to linked page ???

            but if the javascript is not supported or diabled on client machine
            then the above will not work and i am working on a site which is going
            to be accessed by millions of people so may be there are many users on
            whose computer the javascript is disabled or not supported.

            if any other solution without using javascript then let me know

            anyway thxs for your reply....

            Comment

            Working...