473,324 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Change Variables into php file

150 100+
I'm having PHP file that have some variables i want to read all these variables from another PHP file to change them from another page i will create,like configuration file for my site into PHP file how can i do that?
Dec 8 '08 #1
5 1322
Markus
6,050 Expert 4TB
@smartic
include() the file that has the variables in them.

File1.php
Expand|Select|Wrap|Line Numbers
  1. $name = "Mark";
  2. $age = 16;
  3.  
File2.php
Expand|Select|Wrap|Line Numbers
  1. include("file1.php");
  2.  
  3. echo "Name: $name - Age: $age";
  4.  
Dec 8 '08 #2
smartic
150 100+
that is not my point ,my point is to change the variables like in your example the $name value by page i will create that read all the variables in the File1.php and change them,ex: fopen(File1.php) and fwrite(File1.php,new variables) the new variables
Dec 8 '08 #3
dlite922
1,584 Expert 1GB
@smartic
Okay, I think you're a little confused on how PHP works. There is two topics you're touching from what I understand of the broken English.

One is what Markus presented. You include a file and thus can access the variables as if they were in the same file.

Two is writing to a file. That means PHP opens a file to be read or written to, NOT processed.

Perhaps you can tell us what you're trying to do on a higher level and we can see where your going with this. Thanks,





Dan
Dec 9 '08 #4
smartic
150 100+
I'm with option Two read the variables and edit them to use them in other pages like configuration file for my site
Dec 9 '08 #5
Dormilich
8,658 Expert Mod 8TB
but why do you want to edit configurational values? you normally write them once (e.g. as a constant) and then use them over and over.
Dec 9 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

23
by: Mark Parnell | last post by:
I'm relatively new to PHP, and have just converted a site from ASP to PHP. There is one thing I haven't managed to do, though. When the site was using ASP, I had one file (called variables.asp),...
1
by: Gervin | last post by:
That was the first question. BTW, I am using Windows 2000 Server. Second questions is how do I transfer session variables from one virtual website to another website. Currently I have session...
3
by: Cecil Westerhof | last post by:
With global.asa application variables can be set. Later can a script in your application change the value of those variables. But when IIS is restarted the old values are used again. Is there a way...
2
by: Sami | last post by:
I keep getting the famous 'Too Many Connection' Error, and don't know how to change my variables, so they persist even if i have to restart mysql service. Platform: Windows 2003 Server My...
9
by: Nick | last post by:
I have the following code, and it works well on Mozilla 1.6. (However, the image src property cannot be set on Mozilla 1.2.1). Unfortunately, all the code: document.images.itemImage.src =...
2
by: Patient Guy | last post by:
I have a library of functions representing a filesystem interface (essentially a file selection interface, to be used in opening/reading/writing/closing files). Heavily scripted HTML document...
7
by: Michael | last post by:
Hi newsgroup, as the subject indicates I am looking for an advice using global variables. I am not if this problem is more about style then C. If its wrong in thi group, sorry. So I have a...
1
by: Varadha | last post by:
Hi, I am declaring a variable static char Version_No = '1' in header file header.h In a application "app.exe", i am changing the value of the variable in to '2' In the same application i am...
8
by: bim_bom | last post by:
Hi, is there any tool to change naming convention in c++ sources? I mean something, that parses cpp and h files in my project, and it finds, what variables are there declared. I think, it should...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.