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. Link to comment https://forums.phpfreaks.com/topic/159392-confirm-delete-yes-no/ 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. Link to comment https://forums.phpfreaks.com/topic/159392-confirm-delete-yes-no/#findComment-840734 Share on other sites More sharing options...
waynew 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()" Link to comment https://forums.phpfreaks.com/topic/159392-confirm-delete-yes-no/#findComment-840737 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. Link to comment https://forums.phpfreaks.com/topic/159392-confirm-delete-yes-no/#findComment-840980 Share on other sites More sharing options...
jkewlo Posted May 24, 2009 Share Posted May 24, 2009 or use ajax >< Link to comment https://forums.phpfreaks.com/topic/159392-confirm-delete-yes-no/#findComment-841035 Share on other sites More sharing options...
Ken2k7 Posted May 24, 2009 Share Posted May 24, 2009 or use ajax >< For a confirm? Link to comment https://forums.phpfreaks.com/topic/159392-confirm-delete-yes-no/#findComment-841041 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.