Jump to content

Paramater Pick-Up Problem


mickeymouse

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...