Re: confirm box

From: Date: Wed, 09 Oct 2002 14:47:29 +0000
Subject: Re: confirm box
References: 1  Groups: php.general php.windows 
Request: Send a blank email to php-general+get-119442@lists.php.net to get a copy of this message
On your submit button put the following: <input type="submit" name="submit" onClick="return confirm('Are you sure you want to delete??')"> Hope that helps, Craig "Davy Obdam" <info@davyobdam.com> wrote in message news:001a01c26f9e$a1c78a80$9600000a@davy... > 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:info@davyobdam.com > >

« previous php.general (#119442) next »