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

  • SEARCH
  • Home
  • 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 7536321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:32:32+00:00 2026-05-30T06:32:32+00:00

am trying to allow a user to delete a certain image with is in

  • 0

am trying to allow a user to delete a certain image with is in a certain directory. I need them to first specify a directory and then the image which they want to delete.

I have been able to accomplish what I thought would be the hard part, of having their Gallery selection result in a drop-down populated only with the name of those images in their selected gallery.

My issue is that I cannot seem to get the submit button for my second form to trigger the if statement that will delete the files and remove the row from the table. I thought someone here might peruse my code and tell me what I am missing 🙁

thanks a ton!

    <form action ='' name="form1"  method='POST'  enctype="multipart/form-data">
<p>Select Gallery: <select name="gal"  style="color:black;">
    <option value="" style="color:black;"><?php echo $gal; ?></option>
    <option value="graphicdesign/logos" style="color:black;">GD logos</option>
    <option value="graphicdesign/webdesign" style="color:black;">GD website design</option>
    <option value="graphicdesign/advertisements" style="color:black;">GD Advertisements</option>
    <option value="fineart/nature" style="color:black;">FA Nature</option>
    <option value="fineart/people" style="color:black;">FA People</option>
    <option value="fineart/landscapes" style="color:black;">FA Landscapes</option>
    <option value="photography/misc" style="color:black;">PG Misc</option>
    <option value="photography/nature" style="color:black;">PG Nature</option>
    <option value="photography/people" style="color:black;">PG People</option>
</select></p>
<input type="submit" value="Set Galery" style="color:black;"></p>

            <?php 

$connect = mysql_select_db("cynthie") or die("couln't find db on 2 :(");
$metaData = mysql_query("SELECT `name`, `path_full`, `path_thumb`, `galId`  FROM `images`") or die("couln't find table :(");
$gal = $_POST['gal'];

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

                    echo '<form action ="" method="POST"  enctype="multipart/form-data"><p>Select Image: <select name="toDelete" style="color:black;"><p><option style="color:black;">select img</option></p>';
                    while ($displayData = mysql_fetch_assoc($metaData)) 
                    {
                        $names = $displayData['name'];
                        $path_full = $displayData['path_full'];
                        $path_thumb = $displayData['path_thumb'];
                        $galDb = $displayData['galId'];

                        if ($galDb != $gal)
                        {}
                        else
                        {
                            echo '<p><option style="color:black;">'.$names.'</option></p>';
                        }

                    }

                    echo    '</select><p><input type="submit" value="Delete" style="color:black;"></p></form>';

     $connect = mysql_select_db("cynthie") or die("couln't find db on 4 :(");
     $delete = mysql_query("SELECT `id` FROM images WHERE name='$toDelete'") or die("couln't find table on line 81 :(");
    $toDelete = $_POST['toDelete'];     

                    if (isset($_POST['toDelete']))
                        {
                        unlink($path_full);
                        unlink($path_thumb);
                        mysql_query("DELETE FROM images WHERE `id`=$delete");
                        unset($delete);
                        echo '<p>removed!</p>';
                        }
                    else
                    {}

                        }




            ?>
  • 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-30T06:32:33+00:00Added an answer on May 30, 2026 at 6:32 am

    You have your toDelete check inside the gal check, so you need to have $_POST['gal'] and $_POST['toDelete'] being sent. I don’t see gal in your second form, so just add <input type="hidden" name="gal" value="{$_POST['gal']}" />.

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

Sidebar

Related Questions

I am trying to create a Flash application which will allow a user to
I'm trying to allow users to delete multiple records, they click a link delete
So I'm trying to add some ability to my project to allow user-defined properties
I trying to pomp showPermissionDialog for allow the user to post something in a
I am trying to set up a page that will allow the user to
I'm trying to modifty the Flex Tree control to allow a user to select
I'm trying to configure Apache to allow read only access and ask for user
I've been trying to create a client side editor which allows the end user
Im trying to allow users to login to a website by verifying if they
I'm trying to allow user to rename file name, after taking picture, but I

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.