Jump to content

Recommended Posts

Hi, I need my php pages to set some variables on a server level (in a virtual remote hosting) in order to have those variables seen from any other page of my website. I have 2 questions on the matter please:

1) I guess this can be done by using the $_POST array.  is this the best way to set variables at server level?

2) if the use of $_POST is the proper way to set variables/array at server level, how do I assign a $_POST variable? is it compulsory to make a post form or the assignment can be done in an easier way, something like:

$_POST[myvar] = 10;

 

Thank you very much for your help,

Bruno

Link to comment
https://forums.phpfreaks.com/topic/75194-solved-_post/
Share on other sites

Thank you MadTechie for your reply. The problem is that those php pages are not user pages but are pages activated by cron jobs. those scripts works in the background. I need those php scripts to communicate among them by using server level variables. How can a php script set a variable which can be seen by another script (activated by another cron job) in the same website?

Link to comment
https://forums.phpfreaks.com/topic/75194-solved-_post/#findComment-380280
Share on other sites

How can a php script set a variable which can be seen by another script (activated by another cron job) in the same website?

 

The only real solution to this would be to write the variable key / values to a file or a database. Sessions are not maintained upon execution of different scripts called via the command line and post data is simply non-existent.

Link to comment
https://forums.phpfreaks.com/topic/75194-solved-_post/#findComment-380286
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.