I am working on a pastebin-like website where I will take two input fields like so:
<form name="form1" method="post" action="paste.php">
Title: <input type="text" name="title"><br>
Paste: <input type="text" name="paste"><br>
<input type="submit" name="Submit" value="Paste Me">
</form>
and I need to write the data to a file like so:
<?php
$title = $_POST['title'];
$paste = $_POST['paste'];
$fh = fopen("[name variable here].txt", "w");
fwrite($fh, $paste);
fclose($fh);
print "The paste has been submitted.";
?>
But in the $fh line, i need to know how i take the input from "title" and create a new txt file with the contents of the "paste" input. How would I do this?