Okay, I have an external file that saves info in a PHP script...
Code:<title>Links</title> <? $filename = 'install.php'; if (file_exists($filename)) { echo("<META HTTP-EQUIV=Refresh CONTENT='1; URL=install.php'>"); } if(isset($_POST['Submit'])) { ?> <? $dataf = "posts.txt"; $name = $_POST['name']; $message = $_POST['message']; if ($message != "") {$file = fopen("$dataf","a"); $write = fwrite($file," · <a href=$name>$message</a>"); fclose($file); } ?></td> </tr> </table><? } ?> <br> <form name="guestbook" action="" method="post"> URL: <input name="name" size="50" type="text" id="name"> Link Text: <input name="message" size= "50" type="text" id="message"> <input type="submit" name="Submit" value="Submit"><input type="reset" name="Reset" value="Reset"> </form></td> </tr> </table> <br> <br> <? include("posts.txt"); ?>
I need a script that will make it so there is a checkbox next to each one entered and it will allow me to delete the selected ones by clicking a submit button, like in this code...
Code:<?php $file = "todo.list"; $hash = sha1_file ( $file ); if ( isset ( $_POST["submit"] ) && $_POST["ohash"] == $hash ) { if ( $_POST["submit"] == "Add" && ! empty ( $_POST["data"]) ) { $fp = fopen ( $file, "a+" ) or die ("Cannot open $file for writing, check permissions"); fwrite ( $fp, strip_tags( stripslashes($_POST["data"]),"<a><b><i><u><strong>")."\n" ); fclose ( $fp ) ; } elseif ( $_POST["submit"] == "Remove" ) { $data = file ( $file ); $fp = fopen ( $file , "w+" ) or die ("Cannot open $file for writing, check permissions"); $n = 0; foreach ( $data as $line ) { if ( empty ( $_POST["line"][$n] ) ) fwrite ( $fp, $line ); $n++; } fclose ( $fp ); } $hash = sha1_file ( "todo.list" ); } ?> <form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST" name="todo"> <input type="hidden" name="ohash" value="<?php echo $hash ?>" /> <pre> <?php $data = file ( $file ); $n = 0; foreach ( $data as $line ) { echo "<input type='checkbox' name='line[$n]' />" ; echo "<a href=$place>$line</a>" ; $n++; } ?> <input type="text" name="place" size="35" /> <input type="text" name="data" size="35" /> <input type="submit" name="submit" value="Add" /> <input type="submit" name="submit" value="Remove" /> </pre> <hr /> </form>
If you can help, I would really appreciate it.
Thanks!



Reply With Quote
Bookmarks