Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

deleting users by selecting multiple checkboxes

Links for php scripts

Moderators: macek, egami, gesf

deleting users by selecting multiple checkboxes

Postby sansoft » Tue May 11, 2004 4:06 am

Hi all,

I have prepared a form which lists all users along with checkboxes.....now i want to delete the users.....by selecting checkboxes...and pressing delete button...Can anyone help me out......the details of the checkbox are as under....

echo "<td align='center'><input type='checkbox' name='chkuser[]' value='$row[$user_id]'>";

plz help me
sansoft
New php-forum User
New php-forum User
 
Posts: 44
Joined: Fri May 07, 2004 2:16 am
Location: India

Postby Alex » Tue May 11, 2004 5:59 am

ok, if you say that you have prepared a form than all you would need to do is this:
read off your variables
in a for loop check the checkbox array for a true value and at the same time if the value is true add the name to a delete name array
then in another for loop create a query to delete all the information about the selected user...
Alex
New php-forum User
New php-forum User
 
Posts: 180
Joined: Fri Mar 07, 2003 4:59 pm

Postby gesf » Tue May 11, 2004 9:11 am

Hey sansoft, take a look at this code, it may help you!
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

thank you...BUT!!

Postby sansoft » Wed May 12, 2004 3:25 am

hi there,
thank u very much......I have simplified my code to a very high extent....there seems to be a problem......the browser needs to be refreshed everytime by pressing F5 after pressing the delete button......

Any suggesstions????????
sansoft
New php-forum User
New php-forum User
 
Posts: 44
Joined: Fri May 07, 2004 2:16 am
Location: India

Postby gesf » Wed May 12, 2004 11:25 am

For what!? To make the delete process!?

BTW: A great idead is to put the delete code/query in another file instead of having it all in the same file!
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden


Return to PHP Scripts

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron