2
Contributors
7
Replies
8
Views
6 Years
Discussion Span
Last Post by rkayd
0

If you want to send out data as GET

just append '?width=xxx&height=xxx' to href and retrieve using $GET

0

So can I use it something like this: ?width=myWidth&height=myHeight
so that I can place variables in it? Or do I have to concatenate the value somehow, and if so, how do you do that in javascript?

Also, on another page I need to append a php variable to the href so does it work to mix and match the php & javascript variables? That is why I was thinking I would need to use cookies, but maybe it would work like this?

This is sort of how my href would look like:
website.com/page.php?id=&width=[javascript variable]&height=[javascript variable].

I'm guessing it would work to echo javascript codes to the client's computer so maybe this would work. I don't think I have ever done that before.[php variable]&width=[javascript variable]&height=[javascript variable].

I'm guessing it would work to echo javascript codes to the client's computer so maybe this would work. I don't think I have ever done that before.

0

website.com/page.php?id=&width=[javascript variable]&height=[javascript variable]

this is right - set up window.location to the above

in page.php u can retireve the variable as $_GET['id'] etc . about getting php variables as js variables its easy , just google if you dont get it :)[php variable]&width=[javascript variable]&height=[javascript variable]

this is right - set up window.location to the above

in page.php u can retireve the variable as $_GET etc . about getting php variables as js variables its easy , just google if you dont get it :)

0

I am wondering how to get the variables to the href though. If I send the javascript command page.php?width=myWidth, when I get to the other page will width then equal "myWidth" or will it equal the VALUE of myWidth.

I'm not wanting to get php variables as javascript, I am wanting the opposite. I know that isn't possible directly so that is why I am trying to work around it.

These javascript variable will either be read from the href into php or from cookies. I'm quite familiar with requesting php variables from the href, I also know how to post php variables to the href, now all I need to figure out is to post the javascript variables to the href and then possible the php/javascript variables to the href. I haven't had much luck searching for this information in a way that I can understand it but I guess I will keep trying.

0

page.php?width=200px -- its common thing it would have just missed you while commonly browsing thats all

now $_GET -> 200px

0

But the width/height won't be a known number such as 200px. My original javascript function gives me the current size of my browser and I want that variable (whatever it happens to be at the time) to be sent to the href (or cookie, whatever). So it is the variable, NOT a known 200px that I want sent. If it was a standard number that I knew I wouldn't need any of this other stuff including sending the value in an href.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.