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:

<?php
$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" />
</form>
?>

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!

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.

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.