Please help and amend the code Save without repetition required $read[0] I hope that my example is clear to you I apologize for bothering you. I am not good in English
<?php
$fileLocation = getenv("DOCUMENT_ROOT") . "/rt.txt";
$file = fopen($fileLocation,"a");
$n1 = $_POST['n1'];
$n2 = $_POST['n2'];
for($i = 0; $i < count($file); $i++){
$read = explode("|", $file[$i]);
if($n1 == $read[0]){
echo 'Repetition';
}
else
{
fwrite($file,$n1.'|'.$n2."\r\n");
}
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.