View Full Version : iframing a php variable in javascript

01-07-2008, 01:08 AM
Ok, I am attempting to make a code by using the information, but the php variable that I need to use varies according to an ID of a url (e.g. http://.../index.php?id=#). My question is, how would I iframe a php code from one part of the site and get the number total of all of the php variable information to be put on another part? I hope this made sense.

01-08-2008, 12:45 AM
not sure about others, but I didn't really understand what you need or trying to do. Would you be able to explain a little more?

01-08-2008, 02:13 AM
I'll try. Ok, so there are two parts of my site (there is a different coding page for each part) that I want to focus on. One of the parts has the php variable in it. That php variable varies according to an ID of a url (e.g. http://.../index.php?id=#). Each ID has it's own number corresponding to that php variable. So say the ID was 3. The variable would be a certain number if the ID was 3. I want a code that can add up all of the php variable number values (not the ID number), and then I want it to be displayed on another page. Is that a little clearer?

When I say add up all of the values, here's an example of what I mean:

.../page.php?ID=1, $name=3
.../page.php?ID=2, $name=16
.../page.php?ID=3, $name=1
(... refers to the domain name)

In this example, i would add 3+16+1 which would give me 20. I would then display that number on another page. Yet in the code, I want the code to do that itself

01-09-2008, 01:24 AM
Sorry, it's still not clear to me. Sounds like you can easily resolve it without javascript. for example, after you add the value of all the id's, send it via url

May be it's just the title that's throwing me off "iframing a php variable in javascript" ??? If you want to grab the value of a php variable, or even the name of the php variable, using javascript, I don't think you can do it. The only option would be that you output it as html, but don't display it on the screen. Then you can use innerHTML of that html tag to get the value.

01-09-2008, 01:45 AM
It probably is the title, but i was told that this could be done with the use of an iframe. Also, that's not what I wanted, sorry.

01-09-2008, 02:11 AM
Try posting your link. May be then we'll see what's going on.

01-09-2008, 03:14 AM
I would rather not at the moment if that's ok. I thought i explained it pretty clear though.