Passing javascript variables to either PHP or CGI

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
boryev
Forum Newbie
Posts: 5
Joined: Wed Oct 18, 2006 7:54 am
Contact:

Passing javascript variables to either PHP or CGI

Post by boryev »

Hello!
I came across this script :

Code: Select all

<script type="text/javascript">
		var pageViewerID = "somenumbers";
		var pageOwnerID = "somenumbers";
		var pageViewerFName = "someone'sname";
		var pageOwnerFName = "someone'sname";
		var pandoraRegFlag = '-1';
		var userHasBlog = 't';
	
		var HbxTrackingEnabled = false;
		</script>
Its taken from a social networking site where my profile is located! The pageViewerID and pageViewerFName would change everytime a different person views my profile! Now, my question is, how do I store/pass those pageViewerFName and pageViewerID variables to a PHP or CGI page so that the data would be stored and I could see who viewed my profile just by viewing the PHP / CGI page?

Please help me!
Thank you in advance!
Last edited by boryev on Wed Oct 18, 2006 9:17 pm, edited 2 times in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Construct a URL out of them and request something from wherever the PHP file is hosted. An image, some Javascript, something. It's usually better to use an image for various reasons.
boryev
Forum Newbie
Posts: 5
Joined: Wed Oct 18, 2006 7:54 am
Contact:

Post by boryev »

feyd wrote:Construct a URL out of them and request something from wherever the PHP file is hosted. An image, some Javascript, something. It's usually better to use an image for various reasons.
How will I?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

How will you... construct a URL?

http://somesite.com/path/to/a/file.php? ... me2=value2

You probably should be using the escape() function of Javascript on the values (at least).
boryev
Forum Newbie
Posts: 5
Joined: Wed Oct 18, 2006 7:54 am
Contact:

Post by boryev »

feyd wrote:How will you... construct a URL?

http://somesite.com/path/to/a/file.php? ... me2=value2

You probably should be using the escape() function of Javascript on the values (at least).
url of what?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

boryev wrote:
feyd wrote:How will you... construct a URL?

http://somesite.com/path/to/a/file.php? ... me2=value2

You probably should be using the escape() function of Javascript on the values (at least).
url of what?
feyd wrote:An image, some Javascript, something. It's usually better to use an image for various reasons.
Image
boryev
Forum Newbie
Posts: 5
Joined: Wed Oct 18, 2006 7:54 am
Contact:

Post by boryev »

feyd wrote:
boryev wrote:
feyd wrote:How will you... construct a URL?

http://somesite.com/path/to/a/file.php? ... me2=value2

You probably should be using the escape() function of Javascript on the values (at least).
url of what?
feyd wrote:An image, some Javascript, something. It's usually better to use an image for various reasons.
Image
How will I display my profile viewers?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

However you like. The file/script/whatever you request will need to record it in some fashion that you can later extract data from; be it database, flat file, some other storage media is up to you.
boryev
Forum Newbie
Posts: 5
Joined: Wed Oct 18, 2006 7:54 am
Contact:

Post by boryev »

feyd wrote:However you like. The file/script/whatever you request will need to record it in some fashion that you can later extract data from; be it database, flat file, some other storage media is up to you.
How will I do it in PHP and MYSQL?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

boryev wrote:How will I do it in PHP and MYSQL?
What do you have so far?

What is your knowledge level of PHP? .. of MySQL? I'll tell you up front, if you're looking for me to write it for you, you're going to be disappointed; I won't do it.
Post Reply