okay, I combined it wiht my otyher script and now it works except one things...
If you have any checked then it will delete that even if you don't click "delete", such as adding something. Can someone tell me the script to set each button to do a function?
Code:
<?php
$thefile = 'posts.txt';
$dataf = 'posts.txt';
$name = $_POST['name'];
$message = $_POST['message'];
function deleteLine($file, $lineNum) {
$c = file($file);
$c[$lineNum] = '';
$c = implode('', $c);
$f = fopen($file, 'w');
fwrite($f, $c);
fclose($f);
}
if ($message != "") {$file = fopen("$dataf","a");
$write = fwrite($file,"text inserted here
");
fclose($file);
}
if(isset($_POST['lines']))
for($i = 0; $i < count($_POST['lines']); ++$i)
deleteLine($thefile, $_POST['lines'][$i]);
$c = file($thefile);
?>
<form action="<?php echo($PHP_SELF); ?>" method="post">
<?php for($i = 0; $i < count($c); ++$i) { ?>
<label style="display: block;">
<input type="checkbox" name="lines[]" value="<?php echo($i); ?>">
<?php echo($c[$i]); ?>
</label>
<?php } ?>
Link Text: <input name="message" size= "30" type="text" id="message">
URL: <input name="name" size="30" type="text" id="name">
<input type="submit" name="Submit" value="Submit"><input type="reset" name="Reset" value="Reset"><input type="submit" value="Delete these lines">
</form>
i want the red to be used when they click on "delete" and the blue to happen when they click on the "submit" button
Bookmarks