How to EDIT the FILE

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vinoth
Forum Contributor
Posts: 113
Joined: Thu Aug 02, 2007 3:08 am
Location: India
Contact:

How to EDIT the FILE

Post by vinoth »

Hi peoples!!

I have an array on one file based on the array I displays the values on drop down box,

Now the user wants to add the contents of drop down from browser.

So I Have to append the details with in the array, How can I achieve this?

Provide any suggestion or sample code..
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Have you considered using a database (table) for this?
vinoth
Forum Contributor
Posts: 113
Joined: Thu Aug 02, 2007 3:08 am
Location: India
Contact:

Post by vinoth »

No I didn't use any database for this..

Is it any possible way to read the file and insert the new Variable to the array..
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Sure, it's possible, but why aren't you considering the use of a database for this?
vinoth
Forum Contributor
Posts: 113
Joined: Thu Aug 02, 2007 3:08 am
Location: India
Contact:

Post by vinoth »

I already complete the project by using an array.
Now the client add new changes for this thats only I am plan to edit the file..

Please provide some instruction to achieve this
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Using a database doesn't preclude you from using your existing code that works with arrays. It also doesn't preclude you from refactoring your code to be more flexible in the process.

var_export() can be used to great effect if you insist on using a file.
Post Reply