if(isset($_GET[‘pname’]))
{
$pname = trim($_GET[‘pname’]);
}
Info
pname is sent from a another file using url and it used to match with the 3rd colum of the cart file and then delete the line.write back to the same file
Get the separate lines in an array using [fphp]explode[/fphp] by "
", let’s call this $lines
For each of those lines
3a) [fphp]explode[/fphp] the line on "\ "
3b) Check if the third element of the result of 3a equals $pname
3c) If it does, remove the element from $lines
[fphp]implode[/fphp] the array $lines with "
"
Write the data back to the file using [fphp]file_put_contents[/fphp]