OK, I’m getting nowhere, so I’m starting from scratch.
[URL=http://siriustechnology.com/php/table/]HERE
Below is a writetable.php script kindly provided by [b]pyro
Please, tell me what to incorporate into that script so I can utilize [b]edit | delete
I’ve been reading about delete function and found something to this extent (examples from the manual):
[code=php]<?php
// destroy a single variable
unset($foo);
// destroy a single element of an array
unset($bar[‘quux’]);
// destroy more than one variable
unset($foo1, $foo2, $foo3);
?>
I find it difficult to understand (I’m a visual person). Can someone show me something [b]working
here is the original script [b]writetable.php
[code=php]
<?PHP
$filename = “table_text.htm”; #CHMOD to 0666
if (isset($_POST[‘submit’])) {
$contents = file($filename);
$file = “”;
foreach ($contents as $line) {
$file .= $line;
}
preg_match(“/(<table(.*?)> )/is”, $file, $matches);
$tableheader = $matches[0];
list($start, $end) = preg_split(“/<table(.*?)>/i”, $file);
$start .= $tableheader;
$new = ‘<tr>
<td>’.$_POST[‘column_one’].'</td>
<td>’.$_POST[‘column_two’].'</td>
<td><a href=rams/’.$_POST[‘column_three’].’>’.$_POST[‘column_four’].'</a></td>
<td>’.$_POST[‘column_five’].'</td>
</tr>
‘;
$data = $start.$new.$end;
$fp = fopen($filename, “w”);
flock($fp, LOCK_EX);
fwrite($fp, $data);
flock($fp, LOCK_UN);
fclose($fp);
header(“Location:../table_text.htm”);
}
?>
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN”
“http://www.w3.org/TR/html4/strict.dtd”>
<html>
<head>
<title>Administration Options</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<link rel=”stylesheet” href=”../style.css” type=”text/css”>
</head>
<body bgcolor=”#F8F8F8″>
<form action=”<?PHP echo $_SERVER[‘PHP_SELF’]; ?>” method=”post”>
<table width=”186″>
<tr>
<td>Date:</td>
<td>
<input type=”text” name=”column_one”>
</td>
</tr>
<tr>
<td>Author:</td>
<td>
<input type=”text” name=”column_two”>
</td>
</tr>
<tr>
<td>Audio:</td>
<td>
<input type=”text” name=”column_three”>
</td>
</tr>
<tr>
<td>Name:</td>
<td>
<input type=”text” name=”column_four”>
</td>
</tr>
<tr>
<td>Time:</td>
<td>
<input type=”text” name=”column_five”>
</td>
</tr>
</table>
<input type=”submit” name=”submit” value=”Submit New Row” class=”subm”>
<div align=”center”> </div>
</form>
</body>
</html>