473,804 Members | 3,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change Variables into php file

150 New Member
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 1342
Markus
6,050 Recognized Expert Expert
@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 New Member
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.ph p,new variables) the new variables
Dec 8 '08 #3
dlite922
1,584 Recognized Expert Top Contributor
@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 New Member
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 Recognized Expert Moderator Expert
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
5098
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), where I defined various variables that are used throughout the site. I could then access all of these in any other file by simply including that file (using #include), then referencing the variables. I have been unable to do the same thing in...
1
1564
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 variables set in say www.first.com and then I click a link and goto www.second.com. How can I transfer session variables from www.first.com to www.second.com? Both sites are virtual websites and running on the same physical server running Windows...
3
1778
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 to get the changes that are done into global.asa?
2
23821
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 Program is a WebApplication that is written in VB.Net Using ODBC and OLEDB to connect <- (don't blame me, i just took this over) From what i have read so far, the problem is that i need to change
9
2292
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 = itemInfo.imageUrl; //document.getElementById("itemImage").src = itemInfo.imageUrl; document.getElementById("descr").innerHTML = itemInfo.descr; document.getElementById("price").innerHTML = itemInfo.price; doesn't work on IE. What's the proper way to...
2
9174
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 #1, very application-like, must include the JS file for this library of functions. One reason is that it must call a function to name a "callback" function, and within its own script block, must define the callback function. The callback handles...
7
3148
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 couple of function that all need the same information (all located in the same file). By now it looks like /* file beginns */
1
1722
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 calling an function fun1() which is in another dll, MYDll.dll(which is linked implicitly to the exe) which includes the same header file header.h
8
2679
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 have a public "CALLBACK" function (which would be impemented by me), which would tell the program, how to rename variables and functions. It should work like that: I have sourcecode:
0
9587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10588
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.