anzacdan Posted May 22, 2011 Share Posted May 22, 2011 Hey all need some help with the subject title. Have a user text file with all information(Name, address, passwords, etc..) Need to be able to select the user based on Checkbox selection then hit delete button and all users checked will be removed from the txt file and thus removed from HTML page. Im using PHP to show contents of the txt file into my HTML page. So far i have: <?php $file = fopen("user.txt","r"); echo '<table border="0" width="100%"> <tr> <th>Select</th> <th>Username</th> <th>Password</th> <th>FirstName</th> <th>LastName</th> <th>Email</th> <th>Address</th> </tr> '; while(!feof($file)) { $user = explode(":", fgets($file)); echo '<tr> <td><input type="checkbox" name="chkDelete" id = "chkDelete" value="select" /></td> <td>' . $user[0] . '</td> <td>' . $user[1] . '</td> <td>' . $user[2] . '</td> <td>' . $user[3] . '</td> <td>' . $user[4] . '</td> <td>' . $user[5] . '</td> </tr>'; echo '</table>'; fclose($file); ?> Am unsure as to how i would go about doing this, help would be greatly appreciated! Thanks in advanced, Daniel. Quote Link to comment https://forums.phpfreaks.com/topic/237111-how-to-delete-lines-from-a-txt-file-based-on-checkbox-selection/ Share on other sites More sharing options...
anzacdan Posted May 23, 2011 Author Share Posted May 23, 2011 Anyone can help me? Quote Link to comment https://forums.phpfreaks.com/topic/237111-how-to-delete-lines-from-a-txt-file-based-on-checkbox-selection/#findComment-1218904 Share on other sites More sharing options...
wildteen88 Posted May 23, 2011 Share Posted May 23, 2011 How are your users stored within your text file? I guess they are sperated by a : Quote Link to comment https://forums.phpfreaks.com/topic/237111-how-to-delete-lines-from-a-txt-file-based-on-checkbox-selection/#findComment-1219157 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.