Hello everyone, I have a text file which has some values structured as below
--------------------------------------
1
2
3
4
--------------------------------------
Then i made a PHP file which can receive checkbox values (always receive 2,3 & 4) from another HTML file as below
if($_POST['Button']){
$check = $_POST['$boxname'];
foreach($check as $chk ){
echo "$chk<br>"; // Output of this always 2,3 & 4
}
}
-------------------------------------------
I have another script which can read the text file as below
$fileopen = fopen("text.txt", "r");
if ($fileopen) {
while (!feof($fileopen)) {
$read = fgets($fileopen);
$get_string = explode(",",$read);
$values = $get_string[0];
}
}
How can i combine this code with the foreach loop in order to add 1 to the values of the text file if checkbox values are identical to them. I know i can use r+ to write data into a file. But i don't understand how to put them together.
Thanks everyone in advance