Hi everyone
I have a script which contains contains mostly JavaScript. After various bits of user input, it ends up with an array which contains 6 times (hh:mm) and these can be access by times[0] thru times[5]. Obviously these variables would be available on a clients PC.
Another PHP programmer wants to access these 6 variables and use them within his PHP script to display to the user.
What I'm trying to figure out is some way to "present" these variables in such a way that this other programmer can pick them up and do whatever he (or she) wants.
I have had to discard using cookies as you would have to refresh your browser to get access to them, mainly because some of his users wouldn't understand. I have looked at PHP SESSIONS, but I haven't found anything suitable. I have also looked at localstorage and writing the variables to a text file saved on the clients PC.
I believe there is a suitable solution out there somewhere, and I'm hoping that someone on this forum might have an answer.

"Another PHP programmer" could be interpreted many different ways.

That might well be, but don't let it detract from my original question. This "another PHP programmer" works in an entirely different department. All he wants are those 6 JavaScript variables. I am not interested in what he does with them, but they must obviously be in a format he can use.

Terrymold, you missed the point.

What is the other PHP programmer writing :

  • some code for your page(s)?
  • other page(s) on the same site?
  • page(s) for some different site?
  • not a page at all but some data resource to be called via AJAX?

The precise scenario really matters!

I honestly don't know very much at all about what he is doing. When a user uses my script, they enter their postcode in the first section and are then presented with a page which displays these 6 JavaScript variables in a short list in the third section. That part is OK.
The other programmer send a URL with two variables (postcode and a special code) to the middle section of my scripts, The special code just tells my script to go to a special part of my script which creates those 6 variables, but doesn't show any of my code on screen.
As far as I know, the other programmer wants to extract the 6 time variables from my script, and display them on his script as if they came entirely from him.
The main reason I chose to do things this way is that I didn't want him messing with my code, which has happened a couple of times in the past, with dire results.
So that is basically why I don't know or care how he uses those variables. In a recent email from him, he suggested that the variables could be something like this...

"time1":"05:19","time2":"07:09","time3":"12:50","time4":"13:49","time5":"18:30","time6":"20:13"

This is one of those questions that I will understand only when I've seen the answer.

Hi Airshow
I've now been able to change my question, so maybe this is the answer you want?
I have a JavaScript Function which gathers the parameters together and outputs a URL via "alert(buildUrl(url, parameters));", like so...

http://localhost/test.php?time1=05:56&time2=07:26&time3=12:57&time4=15:48&time5=18:28&time6=19:58

which is exactly want I wanted. So my question now is that the url doesn't actually open test.php, which will echo the 6 variables.

What do I need to do now to open test.php from this JavaScript funtion? Obviously, if I open test.php from another browser window, the variables are not there!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.