I am building a template that I can distribute, and I need a user-friendly way that users can fill in their information without touching code (this is just HTML, CSS JS and PHP. Not WordPress). So if the user types in their name, place of work, uploads an image, etc then submits, it would appear in the actual .php file.
Example: After user submits, “name” to appear in between and h1 tag. This should be visible within the actual file, as well as the website.
I’m aware this is very risky and prone to attacks, but I looked everywhere and can’t find anything that exists. Maybe I’m asking the wrong questions? The closet thing I’ve found are “php to txt.file” tutorials. Beginning to think I’ll have to learn a new language to get this done.
This is what I have so far. Most likely won’t be using it, but, is there a better way to do this?
<form method="POST"> <input name="name" type="text" required> <input name="email" type="text" required> <input type="submit" value="Submit"> </form> <?php $name = $_POST['name']; $email = $_POST['email']; $file = fopen("index.php", "a"); fwrite($file, $name . "\n"); fwrite($file, $email . "\n"); fclose($file); ?>