web_master Posted May 23, 2009 Share Posted May 23, 2009 Hi, I have a form, and in a form submit for a delete picture. form is like this: <div><form id="UplAboutForm" action="<?php echo $_SERVER['REQUEST_URI'];?>" method="post" enctype="multipart/form-data"> <div><input name="PhotoDelete" type="submit" class="Submit" value="DELETE" /></div> <div><input type="hidden" name="reload" value="<?php echo $Reload;?>" /></div> <div><input type="hidden" name="aboutus_id" value="<?php echo $Request['aboutus_id'];?>" /></div> </form></div> I want One pop-up window to confirm delete with confirm text "are You..." and with two buttons YES and NO. If they push the YES button If the YES button is pushed the code is like this for deleting picture: <?php if($_POST['PhotoDelete']) { $photo_th = "../r_photoalbum/".$_POST['aboutus_id']."_photo_th.jpg"; $photo = "../r_photoalbum/".$_POST['aboutus_id']."_photo.jpg"; if(is_file($photo_th)) {unlink($photo_th);} if(is_file($photo)) {unlink($photo);} } // End of PhotoDelete ?> So, I know that can be a javascript but I dont find anywhere the "mixed" script with javascript/php to do what I want... thanx in adwanced. Quote Link to comment Share on other sites More sharing options...
Cosizzle Posted May 23, 2009 Share Posted May 23, 2009 I think this would be more of a Javascript question... PHP is all serverside, Javascript is client side thus allowing for popups. Quote Link to comment Share on other sites More sharing options...
waynewex Posted May 23, 2009 Share Posted May 23, 2009 <script> function confirm_delete(){ var delete = confirm("Are you sure that you want to delete this?"); return delete; } </script> onclick = "return confirm_delete()" Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 24, 2009 Share Posted May 24, 2009 You can just return the function call so you don't have to store it in a variable. Quote Link to comment Share on other sites More sharing options...
jkewlo Posted May 24, 2009 Share Posted May 24, 2009 or use ajax >< Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 24, 2009 Share Posted May 24, 2009 or use ajax >< For a confirm? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.