I have this script with like 10 or so textareas. So when you click on submit, they write to a file for a web ticker. However, I wanna be able to back up each individual one. So what I want is a checkbox next to each one, and when u hit a backup button, it will backup ONLY the ones that are checked.
I have some code already, but It needs to be remodifed, big time. Any help on this? Shouldnt be too hard and Im new!
Screenshot included of the admin backend.
PHP code for the backup button trigger
<?
include("conf.php");
$textarea[1] = "$sent1";
$textarea[2] = "$sent2";
$textarea[3] = "$sent3";
$textarea[4] = "$sent4";
$textarea[5] = "$sent5";
$textarea[6] = "$sent6";
$textarea[7] = "$sent7";
$textarea[8] = "$sent8";
$textarea[9] = "$sent9";
$textarea[10] = "$sent10";
$textarea[11] = "$sent11";
$textarea[12] = "$sent12";
$textarea[13] = "$sent13";
$textarea[14] = "$sent14";
$counttextareas = count($textarea);
$array = array();
FOR($i = 1; $i <= $counttextareas; $i++) {
array_push($array, $textarea[$i]);
$today = date("F-d-Y");
$filename = $today.".ticker_archive.html";
$path = "C:/Inetpub/wwwroot/bna-intranet/ticker_archive/";
$somecontent = "<table><tr><td><font face=\"$fontstyle\" color=\"$fontcolor\" size=\"$fontsize\">".$textarea[$i]."</font></tr></tr></table><br />";
// Let's make sure the file exists and is writable first.
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "<p align='left'><b>Successfully</b>, wrote (<font face=\"$fontstyle\" color=\"$fontcolor\">". strip_tags($somecontent) ."</font>) to file<br />";
fclose($handle);
}