Here's what I do:
if ($editmode==TRUE) {
echo('<input type="hidden" name="theblock" value="'.$textblock.'">');
echo("<TEXTAREA NAME=\"TextBlock\" COLS=\"80\" ROWS=\"16\">" . $textblock . "</TEXTAREA><br>");
echo('<input type="hidden" name="edited" value="yes">');
}
else {
echo('<input type="hidden" name="edited" value="no">');
for($i=0; $i<$strarrlen; $i+=2) {
if ($stringarr[$i]!=""){
echo("<input type=\"radio\" name=\"edit\" value=\"" . $stringarr[$i] . "\">");
echo('<input type="hidden" name="line'.$i.'" value="'.$stringarr[$i].'">');
print $stringarr[$i];
echo("<br><br>\n");
}
}
}
The problem is that I later search through the whole file for a match to the line, and it replaces it. But what if the line only conatins a space? Then all spaces are replaced with whatever I input. I need to find a way to get the line number along WITH the line I am editing somehow and put that in a variable. Then I can go directly to that line and check it for the expression (which should match, kind of like assert) and replace it. SO is there any way to get the line AND the text at the same time just by picking one radio button? Please include code for finding the line and replacing it, I do this currently elsewhere:
$string = str_replace($_POST['theblock'], $_POST['TextBlock'], $string);
See above for these variable matches, and everything is written to the file correctly when I edit. Thanks in advance for any help.
EDIT: I added this line (as shown) but I have not yet been able to figure how to use it, so it is not really relevant except to show I tried:
echo('<input type="hidden" name="line'.$i.'" value="'.$stringarr[$i].'">');