0

Hi guys,

I need to pass a variable from a php page to another php page. There are two methods
GET
POST

both involve user action like submitting by clicking a button or clicking a link

How to send a variable without such user actions?

4
Contributors
6
Replies
13
Views
7 Years
Discussion Span
Last Post by deepakrajpal
0

Hi guys,

I need to pass a variable from a php page to another php page. There are two methods
GET
POST

both involve user action like submitting by clicking a button or clicking a link

How to send a variable without such user actions?

This is proving to be a very frustrating issue for me and I would be very grateful is somebody with some experience with php could guide me with this.

0

What is the situation where you wouldn't want some sort of user input? Java/Ajax could do something like that but that's not really my dept. I wouldn't be much help there.

0

What you could do, but really bad style, is making the document refresh automatically with

<META http-equiv="refresh" content="...">

or JS

document.location.href="..."

If you just want to split up your code, than you can access the output of a php-file with

fopen("http://yourserver/yourfixle.php");

but this may make the whole stuff slow down.

But why do you want to run a script when a user is not viewing your site?

0

@CFROG and @SDJH

something.php

<? php
....
....
....
$variable1="good morning";
use api to send this variable and retrieve the results
display results in a webpage
controller.js
display second set of results 
?>


ss.php
<? php
....
....
.... 
use the same $variable1 to call another api and retrieve the results
?>

javascript

controller.js

uses ss.php and modifies the results

Does this make any sense?
I want to display results from two types of api's and show it in one page. The situation is a bit more complicated but the thing is that I want to share/send variables between two different php pages.

Is this possible without creating a form and user clicking the button?

0

I'm not sure what you're after here but it looks like you're already trying to use JavaScript to do this. It can get a bit tricky if you're not familiar with it. To avoid the confusion for you, if at all possible I would just run two separate queries upon page load to display whatever dynamic data you need.

Otherwise you could try something like

<body onload="someJsFunction()">
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.