What I have learned in school is to input and display data using **file\_put\_content()**. But I can't figure it out how to edit/update or deleting the data inside.

My **"form.php"**

```
    <!--Form to the php script-->

<form action="foodscript.php"method="post">
  I love:<br>
  <input type="text" name="foodname" value="">
  <input type="submit" value="Submit">
</form>

```

After I input some food name, it's send to the file call **"foodscript.php"**

```
<?php
  //This is where my input data is being process to the txt file.
   $name= $_POST['foodname'];

  //This is where my data would be store in this file.
   $file= "foodhistory.html"; 

  //The function is begins to created new file and store my data on it.
  file_put_contents($file, $name . PHP_EOL, FILE_APPEND);

 ?>

```

So then, **foodhistory.html** has been created and store a data that I already enter on the form. The Data is call **"Sushi"** inside the **foodhistory.html**.

So my problem is how can I edit/update or delete my data "Sushi" using a new form that has the delete and edit button on it? If you guys have better idea how to do it, do you mind show me the process or ways? I'm just a student.

Many Thanks.