Delete a line containing string in text file using php
<pre><code>&lt;?php
$myFile = "myfile.txt";
$fh = fopen($myFile, 'rt');
$theData = fread($fh, filesize($myFile));
$aDoor = $_GET['idno'];
echo $aDoor;
$theData = preg_replace('/\n?.*$aDoor.*$/m', '', $theData);

fwrite($fh, $theData);
fclose($fh);
echo $theData;
?&gt;
</code></pre>

<p>preg_replace('/\n?.<em>SOMETEXT.</em>$/m', '', $theData); it is working </p>

<p>Now how to use $aDoor string</p>
