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 Quote Link to comment 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... Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.