Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6782905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:47:59+00:00 2026-05-26T16:47:59+00:00

I have a couple of problems. I’m creating a form inside a table, from

  • 0

I have a couple of problems. I’m creating a form inside a table, from what I understand this is not a good idea. But because of the loop I want to make sure the table header is outside so it doesn’t repeat. Is there a smarter way to do this?

Also more importantly I can’t seem to get the delete button to remove the correct video. It seems to delete the last one in the list. Something wrong with how I’m looping over this?

        <p>
        <h3>Recorded Videos</h3>
        <table id="webcam-table">
            <thead>
            <tr>
                <td>Camera Name</td>
                <td>Video Size</td>
                <td>Date Created</td>
                <td>Video Length</td>
                <td>Video Options</td>
            </tr>
            </thead>

        for($i=0;$i<$num_videos;$i++)
        {


<form action="<?php htmlentities($_SERVER['PHP_SELF']);?>" method="POST">
                <input type="hidden" name="video_id" value="<?php echo $result_videos[$i]["video_id"]; ?>" />

            <tbody>
                <tr>
                    <td>
                        <?php echo $result_videos[$i]["camera_name"]; ?>
                    </td>
                    <td>
                        <?php echo $result_videos[$i]["video_size"]; ?>
                    </td>
                    <td>
                        <?php echo $result_videos[$i]["video_datetime"]; ?>
                    </td>
                    <td>
                        <?php echo $result_videos[$i]["video_length"]; ?>
                    </td>
                    <td>
                        <input type="submit" name="delete_video" value="Delete" onClick="javascript:return confirm('Delete this video?');"/>
                    </td>
                </tr>
                </tbody>

        }

            echo "</table>";
            echo "</form>";
            echo "</p>";
    }
}

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

    $video_id = $_POST['video_id'];
    $query_delete_video = 'DELETE FROM `#__videos` WHERE `video_id`='.$video_id;
    $db->setQuery($query_delete_video);
    $db->query();
    header("location: " . $_SERVER['REQUEST_URI']);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:48:00+00:00Added an answer on May 26, 2026 at 4:48 pm

    In your loop you are creating the ‘form’ tag. However you are not closing it each time. This is causing your deleting problem.

    Move

    echo "</form>";
    

    Inside the loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had a look at cx_Oracle but I have a couple of problems with
I have seen couple of similar problems with solutions, but I couldn't find one
I'm learning functional programming, and have tried to solve a couple problems in a
We have a couple of sites which have some memory problems and fairly often
Here's the problem: I have couple of pages which gets its content from a
I have faced this problem quite often during the last couple of months, during
I have a couple of problems using facebook graph api. 1). When i try
I have a couple of basic Rails problems that I'm having trouble finding relevant
I'm faced with a couple of problems in VB.net: I have a series of
I have a couple of problems when doing blending in WebGL. One of them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.