bruno67 Posted October 29, 2007 Share Posted October 29, 2007 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 Quote Link to comment Share on other sites More sharing options...
MadTechie Posted October 29, 2007 Share Posted October 29, 2007 not sure what your asking but why not use Session ? and yes you can do $_POST['test'] = "blar"; but this will only work on code in the current script (or an included file) Quote Link to comment Share on other sites More sharing options...
bruno67 Posted October 29, 2007 Author Share Posted October 29, 2007 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? Quote Link to comment Share on other sites More sharing options...
MadTechie Posted October 29, 2007 Share Posted October 29, 2007 if reg.php is a post form you can do something like this $_POST['submit'] = "submit"; $_POST['name'] = "bob"; include "reg.php"; or change the reg form to check a session and pass the data that way.. or am i missing something ? Quote Link to comment Share on other sites More sharing options...
trq Posted October 29, 2007 Share Posted October 29, 2007 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.