I've created an html page with forms, and what I need is for each new person that clicks the 'submit' button, have the text in the fields print to a new line in the output.txt file on the web host.
This is what I have so far:
<?PHP
$filename = "output.txt"; #Must CHMOD to 666
$quantity = $_POST['quantity'];
$item = $_POST['item'];
$fp = fopen ($filename, "w"); # w = write to the file only, create file if it does not exist, discard existing contents
if ($fp) {
fwrite ($fp, $quantity . ", " . $item);
fclose ($fp);
echo ("Thank you for submitting your video!");
}
else {
echo ("There was a problem submitting your video. Try again, or report the issue.");
}
?>
Here's the HTML code:
<form action="process.php" method="post"><br /><br />
Link to YouTube Video:<br /><input name="quantity" type="text" size="50"/><br /><br />
Description of Video: <br /><textarea cols="38" rows="5" name="item"></textarea><br /><br />
<input type="submit" />
</form>
Also,
1. How could I have each line numbered for each new submission?
2. How can I make the text from '$quantity' turn into a link in the output.txt file?