Jump to content

Simple question regarding $_GET


julisana

Recommended Posts

Hi Guys!

 

I've got a simple question regarding $_GET.  I'd like to be able to append variable values to the end of a URL instead of writing out the entire link + variable values.  That way the values can be added or removed as needed.

 

Unfortunately, I'm just not sure how to do it.  What's the best way to go about this, and is it just as simple as throwing a value into a $_GET element before directing to the same page?

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/187581-simple-question-regarding-_get/
Share on other sites

Not exactly sure what you are asking. But maybe something like this:

$when='after_school';
$what='piano_lessons';
$where='gingerbread_house';
$url='http://WolfWoods.com/';
$page='index.php';
$gets="?when=$when&what=$what&where=$where";
echo "<a href=\"$url$page$gets\">MyLink</a>";

Not exactly sure what you are asking. But maybe something like this:

$when='after_school';
$what='piano_lessons';
$where='gingerbread_house';
$url='http://WolfWoods.com/';
$page='index.php';
$gets="?when=$when&what=$what&where=$where";
echo "<a href=\"$url$page$gets\">MyLink</a>";

 

to finish that off when you load the new page in order to get the info you will need $_GET['when'] $_GET['what'] and $_GET['where'] and put these into variables again.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.