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 6023071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:57:03+00:00 2026-05-23T03:57:03+00:00

<?php $imgcheck=mysql_query( SELECT * FROM `images` WHERE `deal_id` =$_SESSION[eid] LIMIT 0 , 30 );

  • 0
<?php     
 $imgcheck=mysql_query("

  SELECT *
FROM `images`
 WHERE `deal_id` =$_SESSION[eid]
LIMIT 0 , 30

 ");
 $numimgcheck=mysql_num_rows($imgcheck);
  if($numimgcheck==0){echo '<span style=color:#ff0000; >No pictures uploaded</span>';}
    while ($rowimg2= mysql_fetch_array($imgcheck)){ 


     $imgname=$rowimg2['name'];

     {
    //   $rowimg2 = mysql_fetch_array($imgcheck) or die(mysql_error());

     //echo $imgname;
     echo '    <a href="users/'.$_SESSION['userid'].'/images/'.$imgname.'"   rel="lightbox[slide]" caption=".">';
       }


       { echo '<img src="users/'.$_SESSION['userid'].'/images/thumbs/'.$imgname.'"   border="0" />';}
     { echo '</a><a href="delimg.php?id='.$imgname.'"><img src="images/del.jpg" width="22" height="22" onclick="deleteImg(this);" />   </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     ';

    }

  //<input type="checkbox" name="'.$imgname.'" id="'.$imgname.'" > if($numimgcheck==0){      $havepic=' <td width="50px" align="center"><div class="iddivimg"> <img src="users/default/nopic_small.jpg"  />

// ‘;}

    }
    ?>

There is a page in my website where users can edit and delete images. In this page, there is a delete button (itself a 20×20 image) near every image. When the user clicks on that button, its corresponding image will be deleted. I want it to be in such a way that when I click the delete image a confirm box should appear, asking “Are you sure you want to delete this image?” If I click yes, I want to delete the MySQL table’s data and image. If I click no, nothing should happen. How can I do this?

  • 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-23T03:57:04+00:00Added an answer on May 23, 2026 at 3:57 am

    Put each image in its own form with the image identifier as hidden value and use the delete image as CSS background image of the submit button. Finally use JS confirm() function for the confirmation.

    <form action="delete.php" method="post">
        <img src="image1.png" />
        <input type="hidden" name="id" value="1" />
        <input type="submit" class="delete" value="" onclick="return confirm('Sure?')" />
    </form>
    <form action="delete.php" method="post">
        <img src="image2.png" />
        <input type="hidden" name="id" value="2" />
        <input type="submit" class="delete" value="" onclick="return confirm('Sure?')" />
    </form>
    ...
    

    with CSS

    .delete {
        background-image: url('delete.png');
        width: 20px;
        height: 20px;
        border: 0;
        cursor: pointer;
    }
    

    This is easily done in a loop. You could use jQuery to unobtrusively introduce ajaxical powers, whenever necessary.

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

Sidebar

Related Questions

PHP: $SQL = SELECT goodies FROM stash WHERE secret=' . str_replace(','',$_POST['secret']) . '; Could
search.php $text = $mysqli->$_POST['term']; $query = SELECT name FROM males WHERE name LIKE '%
php newbie here..I need some PHP help ideas/examples on how to import data from
PHP Version: 5.3.3 I'm using the SOAP extension to pull data from a web
PHP currently will not log errors produced from the command line. I have: log_errors
My PHP is unable to read a cookie like this: 1010081-COP-9-20-20110606172032 echo $_COOKIE[SubmCookie]; It
My PHP code: include something.php $mysite = writeContent(); //footer.php ob_start(); echo <script...all my javascript
PHP has a great function called htmlspecialcharacters() where you pass it a string and
PHP's explode function returns an array of strings split on some provided substring. It
PHP, as we all know is very loosely typed. The language does not require

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.