mickeymouse Posted December 5, 2019 Share Posted December 5, 2019 I understand that to pass a paramater from one page to another from a call in a function I must have "?param=myparam" following my page id. e.g. function ancesterF(myparam) {location.href='mypage1.php? param=myparam';return false; window.open(location.href); return false;} and to pick-up the paramater in the called page, I need to use: $getmyparam=$_GET['param']; However, it doesn't work. The resulting pick-up is "myparam" instead of the value of "myparam" which is "10006" Does anyone know how to pick-up the value passed? I can't find anything about this in PHP documentation. Many thanks Link to comment Share on other sites More sharing options...
dsonesuk Posted December 5, 2019 Share Posted December 5, 2019 The clue is in what actually happened! ?param=myparam (as in index = value) $getmyparam=$_GET['param']; (apply index value to $getmyparam) returns 'myparam' (the value) myparam should be 10006. Its treating myparam as a string, not parameter variable, you have to separate the variable from the string {location.href='mypage1.php?param='+myparam;return false; window.open(location.href); return false;} 'mypage1.php?param=' is string part, while +myparam will now join the value of myparam to rest of string Link to comment Share on other sites More sharing options...
mickeymouse Posted December 6, 2019 Author Share Posted December 6, 2019 Thank you dsonesuk. It works perfectly (all the time when we do it right) I'd like to give you points but don't know how. Can't see anything on the page that would allow me. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now