Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Alex Forseth
Alex Forseth
8,017 Points

What is the purpose for relaying information back and forth between pages using the URL in PHP?

I mean exactly what the title of the question asks.

1 Answer

eberhapa
eberhapa
51,495 Points

For e.g. searchfields are using parameters in the url. why? Because if you search something and want to share your searchresults with someone else you just have to copy and pase the whole link with the search query inside. Or image you have a website for an event. And on this page you have a contact button but the contact form is on an other page. With a url parameter you could link to the contact page and prefill the subject with the title of the page with the contact button. An other example is form validation. With php you check if the form is filled out correclty and if not you could set an url parameter and check if isset than output an error class in html or something like that.

Hope it clarified it a little bit. Best Patrick