使用php mysql和html的文本协作系统

I am trying to create a parent child text collaboration system and the parent text can have more than one child. for instance :

text 1 can be edited and have edit two and text 1 can be edited again and have edit three edit three can be edited and become edit four and so on.

Below is the script I have but it only allows a user to edit the original text input : index.php

<?php
    include 'includes/connection.php';

    $query = "SELECT * FROM branches";  
    $result1 = mysql_query($query) or die(mysql_error());

    while($person = mysql_fetch_array($result1)) {  //As long as there is data, output the data
            $id = $person['ID'];
            $query2 = "SELECT * FROM branchesedit WHERE (parent_id = '$id' )";
            $result2 =  mysql_query($query2) or die(mysql_error());


            echo "<h3>" . $person['Names'] . "</h3>";
            echo "<p>" . $person['Lyrics'] . "</p>";
            echo "<a href=\"modify.php?id=" . $person['ID'] . "\">Modify Song</a>";
            echo "<span> </span>";
            echo "<a href=\"delete.php?id=" . $person['ID'] . "\">Delete Song</a>"; 

                while($row2 = mysql_fetch_array($result2)){
                    echo "<h3>" . $row2['Name'] . "</h3>";
                    echo "<p>" . $row2['LyricUpdate'] . "</p>";
            }
    }
?>

modify.php

<?php
    if(isset($_POST['submit'])) {
        $query = "SELECT ID FROM branches WHERE ID = $_GET[id]";

        mysql_query("INSERT into branchesedit(`IDs`, `Name`, `LyricUpdate`, `parent_id`)
            VALUES ('','$_POST[inputName]', '$_POST[ta]', '$_POST[id]')") or die(mysql_error());

        echo "Song has been modified";
        header("Location: index.php");  
    }
?>