Hi ,
Change  "OnSubmit=return ConfirmDelete();".
Add your code "return" Like this :)

<?php
//Guestbook admin page
echo "
<form name=\"admin\" onSubmit=\"return ConfirmDelete();\">"; // <--- -=-=-=- THIS LINE 
-=-=-=-
//The rest of my form
echo "
<input type=\"submit\" name=\"submit\" value=\"delete\">
</form>";
?>

Have a nice day.







                                                                                       
                             
                    "Davy Obdam"                                                       
                             
                    <info@davyobda       To:     "PHP Mailinglist" 
<[EMAIL PROTECTED]>, "PHP-WIN            
                    m.com>                Mailinglist" <[EMAIL PROTECTED]>     
                             
                                         cc:     (bcc: EMIN CALIKLI/FINANSBANK)        
                             
                    09.10.2002           Subject:     [PHP] confirm box                
                             
                    17:17                                                              
                             
                                                                                       
                             
                                                                                       
                             




Hi people,

Maybe a bit off-topic, but i thought lets ask anyway. I have a guestbook
admin page were i can delete multiple items from the database using
checkboxes. So when i click on the Submit button i would like a
javascript confirm box coming up. I have done that, but it deletes the
item(s) anyway, also if i click on cancel.

This is my javascript code in the head of the document:

<script language="JavaScript" type="text/javascript">
<!--
function ConfirmDelete() 
{
  input_box=confirm("Are you sure that you want to 
delete the
selected items?");
 if (input_box!=true) 
    {
   return false;
      } 
  else
     
{
   return
true;
    }
}
//-->
</script>

This is what i use in my PHP code:

<?php
//Guestbook admin page
echo "
<form name=\"admin\" onSubmit=\"ConfirmDelete();\">";
//The rest of my form
echo "
<input type=\"submit\" name=\"submit\" value=\"delete\">
</form>";
?>

<?php
//Delete items from guestbook
if(isSet($submit))
{
           //Delete items
}
?>

Any help is appreciated, thanks for your time,

Best regards,

Davy Obdam,
mailto:[EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to