Re: Deleting multiple names from the database at once

From: Date: Fri, 01 Sep 2000 17:10:06 +0000
Subject: Re: Deleting multiple names from the database at once
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-14840@lists.php.net to get a copy of this message
On Fri, 01 Sep 2000, Siim Einfeldt wrote: > Hi all > > Last email I received from some mailing-list, started "Hi, My name > is John and I have a problem..". I thought I won`t start like this, but > I still need some help. > > Anyway, I have a list of names, e.g > ->John > ->Mary > ->Someone else > > I get these names from the database using while this, echo this method. > e.g: > $getinimesed = mysql_query("SELECT * FROM inimesed"); > echo "<FORM METHOD=POST > > ACTION='adminpage.php3?adminame=$adminame&adminpass=$adminpass&id=id'>"; > while ($see = mysql_fetch_array($getinimesed)){ > $nimi = $see["name"]; > $code = $see["isikukood"] > echo "<INPUT TYPE='checkbox' name='$code'><a > href='javascript:openit()'>$name</a><BR>"; > } > echo "<INPUT TYPE='Submit' VALUE='DELETE'> > </FORM>"; Set a value on each of your checkboxes <INPUT TYPE="CHECKBOX" NAME="delete[]" VALUE="$code"> Then loop though the delete[] array you get from the post and build a query (or do a bunch of delete queries..whatever you like) -- James Atkinson ----------------------------------------------------------------- James Atkinson 100world Technical Developer 512-1529 West 6th Avenue phone: +1-604-637-8122 Vancouver, BC, V6J 1R1 fax: +1-604-742-1770 Canada email: james.atkinson@100world.com http://www.100world.com +---------------------------------------------------------------+ | This message may contain confidential and/or privileged | | information. If you are not the addressee or authorized to | | receive this for the addressee, you must not use, copy, | | discolse or take any action based on this message or any | | information herein. If you have received this message in | | error, please advise the sender immediately by reply e-mail | | and delete this message. Thank you for you cooperation | +---------------------------------------------------------------+

« previous php.general (#14840) next »