Hi,

I cant get my around this..

I want to store some config details in config.php like so..

$conf['audio'] = "play";
$conf['email'] = "send";
..
..
..

how can i use a form to edit the variables by writing to the file.

The form will have the option to change any or the variables so one might get changed and the other may not. Or multiple oprtions might get changed at same time.

i have had a play with file WRITE and APPEND but keep losing stuff and getting strange results. i would post but i deleted the failed attempts.

Any help would be great
thanks
Vince

Recommended Answers

All 3 Replies

Member Avatar for diafol

perhpas storing the data in a DB would be better.
else you could store data in a text file, but that's really awkward.

config TABLE

[B]config_id  config_key  config_value[/B]
1          email       send
2          audio       play

sorted it, was easier than it seemed lol.

include the config in the page with form. set the default value of form fields as per the file included.
on form submit write every field to file
$stringData = "define(\"AUDIO\",\"FALSE\");\n";

Member Avatar for diafol

ok mark as solved (link below the edit box)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.