I authored this site with my really small understanding of PHP.

The 2nd table Courses will need an not enroll button that'll be displayed alongside each row of information, so when known as execute the remove query.

The button to date is displayed however i dont understand how to allow it to be remove the record. I'm searching to remove the entire record. displayed .

Are you able to please look the code and advise us a workaround?

Thanks

    <form name="form1" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">


    /* New Code */
    //if($_POST['formSubmit'] == "Submit") 

    if (isset($_POST['formSubmit'])) {

    $database =& JFactory::getDBO();
    $database->setQuery("DELETE * FROM jos_jquarks_persontraining WHERE
      user_id = '246'"); 
    }


    $database =& JFactory::getDBO();
    // Display enrollments
    echo "<h1>";
    echo "<span style='text-decoration: underline;'>";
    echo "Courses : " ;
    echo "</h1>";
    echo "</b>";

    echo "</br>";
    echo "</br>";

    $database->setQuery("SELECT jos_jquarks_persontraining.id,training.training, 
    DATE_FORMAT(training.trainingDate, '%W, %M %e, %Y'),
    training.trainingHour, training.course_location,
    date_format(jos_jquarks_persontraining.timeStamp,'%m/%d/%Y')  
    FROM jos_jquarks_persontraining 
    INNER JOIN training ON  jos_jquarks_persontraining.training_id = training.training_id
    WHERE
      jos_jquarks_persontraining.user_id =  " .$id  ) ;

    if (!$database->query()) 
    { 
        echo "<script> alert('".$database->getErrorMsg()."'); </script>";
    }

    $tableStyle = "padding: 5px;border:1px solid black"; 
    $tdStyle = "padding:5px"; 
    $thStyle = "padding:7px";

    $row = $database->loadRowList();
    if ( 0<count($row)) {
        echo '<table style="', $tableStyle, '" cellpadding="7" cellspacing="7">';  
        echo '<tr><th style="', $thStyle, '" align=center>Id</th><th style="', $thStyle, '" align=center>Course</th><th style="', $thStyle, '" align=center>Date</th>
        <th style="', $thStyle, '" align=center>Time</th>
    <th style="', $thStyle, '" align=center>Location</th>

    <th style="', $thStyle, '" align=center>Enrollment Date</th>
    <th style="', $thStyle, '" align=center>Action</th>'; 


        $row = $database->loadRowList();
        foreach($row as $valuearray) {
            echo '<tr align="center">';

            foreach($valuearray as $field){
                echo '<td style="', $tdStyle, '" align=center>', $field, '</td>'; 

            } // field
            echo '</tr>';

    echo '<tr align="center">';
    echo'<td>';
    echo '<input type="submit" name="formSubmit" value="Unenroll" />';
//This button needs to submit or call the delete function!!
    echo '</td>';
    echo '</tr>';


        } // $valuearray
        echo '</table>'; 
    } // if count
    ?>
    </form>