From: "Ryan A" <[EMAIL PROTECTED]> > I have a set of scripts that read off a config_inc.php file (eg: database, > username,password, admin_username,admin_pass etc), instead of the client > manually making the changes (with mistakes sometimes) I have made a form > where the client can pick most of the values via a drop down box and then > submits the form and the config file gets built... > > I have gotten as far as building the HTML form and according to the input, > set the variables, how do I create the php file and force a download so the > client simply downloads the file, then uploads it to the programs directory?
Same as you write any other file, fopen, fwrite, fclose, etc, then send the appropriate headers to trigger a download of the file (discussed on here plenty of times). <?php $fp = fopen('config.php'); fwrite("<?php\n\n\$somevar = " . $somevalue . ";\n\$somevar2 = " . $somevalue2 . ";\n?>"); // etc... (add in quotes around strings, of course) fclose($fp); You don't even have to actually write the file if you're just going to send them the data. You can send the download headers and then echo out what you would have written to the file. The end result to the user will look like they're downloading a file, although one never really existed on the server. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php