How to set a session variable when clicking a link

后端 未结 4 1712
不知归路
不知归路 2020-12-24 08:40

I have the following problem... I want to set a session variable when clicking on a normal link like:

home
         


        
4条回答
  •  佛祖请我去吃肉
    2020-12-24 09:05

    I had the same problem - i wanted to pass a parameter to another page by clicking a hyperlink and get the value to go to the next page (without using GET because the parameter is stored in the URL).

    to those who don't understand why you would want to do this the answer is you dont want the user to see sensitive information or you dont want someone editing the GET.

    well after scouring the internet it seemed it wasnt possible to make a normal hyperlink using the POST method.

    And then i had a eureka moment!!!! why not just use CSS to make the submit button look like a normal hyperlink??? ...and put the value i want to pass in a hidden field

    i tried it and it works. you can see an exaple here http://paulyouthed.com/test/css-button-that-looks-like-hyperlink.php

    the basic code for the form is:

        

    the basic css is:

        #hyperlink-style-button{
          background:none;
          border:0;
          color:#666;
          text-decoration:underline;
        }
    
        #hyperlink-style-button:hover{
          background:none;
          border:0;
          color:#666;
          text-decoration:none;
          cursor:pointer;
          cursor:hand;
        }
    

提交回复
热议问题