Jump to content
mickeymouse

Paramater Pick-Up Problem

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...