How to pass a PHP variable using the URL

后端 未结 6 523
暖寄归人
暖寄归人 2020-11-30 04:20

I want to pass some PHP variables using the URL.

I tried the following code:

link.php





        
6条回答
  •  无人及你
    2020-11-30 04:52

    You're passing link=$a and link=$b in the hrefs for A and B, respectively. They are treated as strings, not variables. The following should fix that for you:

    echo 'Link 1';
    
    // and
    
    echo 'Link 2';
    

    The value of $a also isn't included on pass.php. I would suggest making a common variable file and include it on all necessary pages.

提交回复
热议问题