I was wondering if anyone could help me with what should be a simple PHP script. I want to write a text file, inputing different strings to different lines using some predefined lines and some input from a text box, then save it with another extension (such as .ini). Here's what I have:

$title = "[Readme]";                          //
$reg_ad = "{AV232312 - B321 - ...}"; // Just random strings to insert
$icon_ad = "Icon=happy.ico";            //
<form action="customscript.php" method="get">
Your Name <input type="text" name="name" />
<input type="submit" />

I'm not sure how to create/open a file and then insert the strings into it. I also was wondering if I could enable the form to upload a file to my server. Thanks for your help!

10 Years
Discussion Span
Last Post by nav33n

Writing data to a file is very simple. Open a file with different modes using fopen. Write contents to it using fwrite. Then close the file. http://nl.php.net/manual/en/function.fopen.php . I dont understand what exactly you mean by enable the form to upload a file to my server. Isn't file uploading enabled in your server ?


Thanks the link helped a lot! File uploading is enabled on my server but I'm not familiar with the code to allow a user to upload.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.