0

i'm new with php and cant understand how to do that right. i'm trying to save to input data into a txt file.

if have this html form:

<form action="test.php" method="post">
<div>
<label for="theDate">When?</label>
<input type="text" data-inline="true" name="theDate"  />
<label for="theNote">What?</label>
<input type="text" data-inline="true" name="theNote"  />
</div>
<button type="submit" data-inline="true">Save Note</button>
</form>

test.php look like that:

<?php
$f = fopen("notes.txt", "a");
fwrite($f, $_POST["theDate"] . $_POST["theNote"]);  //chris85 suggest..
fclose($f);
?>

what am i doing wrong? and how can i add message for success (or error) after submit?

A. Meshu
  • 4,053
  • 2
  • 20
  • 34

0 Answers0