Can php add variables to the link address?

Source: Internet
Author: User
Tags wordpress blog
Can php add variables to the link address? I used wordpress to create a blog-like website (website a.com/B) and another homepage a (website a.com)
There are two links in Homepage a to select the user region (such as Shanghai and Beijing), but the two links actually point to the same website a.com/B (the homepage of wordpress blog) I modified the database and used the following code to display different article lists through different links.
Echo "Beijing



Shanghai ";
My blog page is similar to the following layout
Introduction to Article Classification
Article 1
Article 2
...

Now, after selecting different addresses on the homepage, the corresponding article list will be displayed after you jump to the blog page (implemented by passing values through the above code)
But the problem is that once I click a message and then click the document category to display the article, it is not based on the address I selected at the beginning.
Because there is no such conduction value
In addition, I cannot write several message links that correspond to different address categories as on the homepage.
Is it possible to add a variable in the link address?
For example, the variable v is a number.
There is a jump link a.com/ B /? B = v
Write down the value of v.
V different jump to different web pages

If you have any other solutions, thank you. the website is facing this problem. could you please help? =
Actually, I don't know much about the code. if I don't understand it, please ask me. thank you.


Reply to discussion (solution)

When you submit a message, you can set the parameter B = 2.

When you submit a message, you can set the parameter B = 2.

But the address is user-selected, not every time it is 2. sometimes it is 1 or 3. what should I do?

Different sources are displayed on the same page.

Can I go back? Or does it always show the content determined by the user source? For example, it only displays Beijing on the homepage?

Then, when determining the region to be displayed, store a session. when you need to judge again next time, you do not need to directly use the session to determine based on the source.

Yes. Url? B =


When you submit a message, you can set the parameter B = 2.

But the address is user-selected, not every time it is 2. sometimes it is 1 or 3. what should I do?

'>



When you submit a message, you can set the parameter B = 2.

But the address is user-selected, not every time it is 2. sometimes it is 1 or 3. what should I do?

'>

Global $ idbzn;
$ Locationxuanze = $ _ GET ['idbzn '];
If (! Isset ($ locationxuanze) AND isset ($ _ COOKIE [cookielocationxuanze])
{
Header ("Location: http://www.a.com/ B? C = <? Php echo $ _ COOKIE [cookielocationxuanze];?> ");
}
?>
I used all the variables in the above code and output them. it is correct. if you can output a string at will, but if you change to link jump, there will be a problem. can you see where the problem is? thank you.

Yes. Url? B =
Global $ idbzn;
$ Locationxuanze = $ _ GET ['idbzn '];
If (! Isset ($ locationxuanze) AND isset ($ _ COOKIE [cookielocationxuanze])
{
Header ("Location: http://www.a.com/ B? C = <? Php echo $ _ COOKIE [cookielocationxuanze];?> ");
}
?>
I used all the variables in the above code and output them. it is correct. if you can output a string at will, but if you change to link jump, there will be a problem. can you see where the problem is? thank you.


Yes. Url? B =
Global $ idbzn;
$ Locationxuanze = $ _ GET ['idbzn '];
If (! Isset ($ locationxuanze) AND isset ($ _ COOKIE [cookielocationxuanze])
{
Header ("Location: http://www.a.com/ B? C = <? Php echo $ _ COOKIE [cookielocationxuanze];?> ");
}
?>
I used all the variables in the above code and output them. it is correct. if you can output a string at will, but if you change to link jump, there will be a problem. can you see where the problem is? thank you.

Header ("Location: http://www.a.com/ B? C = <? Php echo $ _ COOKIE [cookielocationxuanze];?> ");
Change
Header ("Location: http://www.a.com/ B? C = ". $ _ COOKIE [cookielocationxuanze]);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.