将div id输入到文本框中,并在按下提交时将其从文本文件中删除

I have been racking my brain trying to get a very particular function to work. It seems simple but I just cant figure it out. I am looking to basically get a txt file and allow someone to type in a certain id into an input box that upon the user clicking "delete" will remove only the targeted DIV id.

I have tried wrapping a PHP file around a form with no success, as well as putting the PHP directly into the submit button but nothing has worked, can anyone point me in the correct direction?

I have looked for other post here but nothing seems to be exactly what im looking for or I am wording it incorrectly. This is essentially how I want it to look:

<form action='delete.php' method='post'>
<input name='idinput' type='text' value='Enter The Certain ID Value You Want To Remove'>
<input type='submit' name='submit' value='Remove'>
</form>

Not sure about the text file bit but to remove an element from the DOM, well, you can't do this in PHP without reloading the page and apssing in some extra data na dusing some logic to not display that element...

You need to use JavaScript... or with JS with jQuery

$(function(){
    $('input[name="submit"]').on('click', function() {
       var val = $('input[name="idinput"]').val();
       $('#or.IDorCLASSNAME_' + val).remove(); //If Id Input val is 3 this gives #or.IDorCLASSNAME_3
    });
});

jQuery: https://api.jquery.com

jQuery Remove: https://api.jquery.com/remove/

jQuery DOM Removal: https://api.jquery.com/category/manipulation/dom-removal/

Tutorial: https://www.w3schools.com/jquery/jquery_dom_remove.asp

I was able to do this by placing a form that is inserted within the txt info im submitting:

<form action='delete.php' method='post'>
<input type='hidden' name='random' id='random' value='".$random."'>
<button type='submit' value='report'></button>
</form>

And also by adding this to the delete.php page:

<?php 
$random = $_POST['random'];
$original = "<div id='".$random."'>";
$replacement = "<div id='".$random."' class='hidden'>";
$str = file_get_contents('submissions.txt');
$str = str_replace("$original", "$replacement",$str);
file_put_contents('submissions.txt', $str);
header('Location: index.php');
?>