TGWSE_GY Posted June 10, 2009 Share Posted June 10, 2009 I am wondering if when using header you can pass more than 1 variable in the header and if so how do you separate the variables? Thanks Link to comment https://forums.phpfreaks.com/topic/161672-solved-passing-multiple-variables-in-header-url/ Share on other sites More sharing options...
haku Posted June 10, 2009 Share Posted June 10, 2009 You can set whatever headers you want. Ex: header('var1=' . $var1); header('var2=' . $var2); and so on... Link to comment https://forums.phpfreaks.com/topic/161672-solved-passing-multiple-variables-in-header-url/#findComment-853064 Share on other sites More sharing options...
TGWSE_GY Posted June 10, 2009 Author Share Posted June 10, 2009 okay here is what the header looks like so far, header ("Location: http://www.thegayestcommunityever.com/dev/index.php?section=fsearchresults"); that forwards them to the next page but I am wanting to pass an additional value with that header would I use & char for separating variables in header. Thanks Link to comment https://forums.phpfreaks.com/topic/161672-solved-passing-multiple-variables-in-header-url/#findComment-853068 Share on other sites More sharing options...
haku Posted June 10, 2009 Share Posted June 10, 2009 Ahh, you are mixing up headers, and URL variables. The headers are information that are sent along with a document to tell the receiving system what to do with it. I told you how to pass some variables as headers - but you have to pull them out as headers as well. You are trying to pass variables in the URL. You can do that like this: example.com?var1=dog&var2=cat&var3=monkey Separate each of the variables using the & sign. If you are using XHTML, then you probably want to use this instead: example.com?var1=dog&var2=cat&var3=monkey separate each of the variables using & - this is valid XHTML. Link to comment https://forums.phpfreaks.com/topic/161672-solved-passing-multiple-variables-in-header-url/#findComment-853073 Share on other sites More sharing options...
TGWSE_GY Posted June 10, 2009 Author Share Posted June 10, 2009 Okay so once that variable is passed via the header how do I pull it from the header? Thanks Link to comment https://forums.phpfreaks.com/topic/161672-solved-passing-multiple-variables-in-header-url/#findComment-853082 Share on other sites More sharing options...
haku Posted June 10, 2009 Share Posted June 10, 2009 Mate, you didn't read what I wrote. You aren't passing variables in the header, you are passing variables in the URL. To get the values, you use: $_GET['var1'] // This will be equal to dog $_GET['var2'] // This will be equal to cat $_GET['var3'] // This will be equal to monkey Link to comment https://forums.phpfreaks.com/topic/161672-solved-passing-multiple-variables-in-header-url/#findComment-853113 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.