Deleting xml file using radio value
- by ???? ???
i using php to delete file, but i got table loop like this:
<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
<tr class="bg_tableheader">
<th class="table-header-check"><a id="toggle-all" ></a> </th>
<th class="table-header-check"><a href="#"><font color="white">Username</font></a> </th>
<th class="table-header-check"><a href="#"><font color="white">First Name</font></a></th>
<th class="table-header-check"><a href="#"><font color="white">Last Name</font></a></th>
<th class="table-header-check"><a href="#"><font color="white">Email</font></a></th>
<th class="table-header-check"><a href="#"><font color="white">Group</font></a></th>
<th class="table-header-check"><a href="#"><font color="white">Birthday</font></a></th>
<th class="table-header-check"><a href="#"><font color="white">Gender</font></a></th>
<th class="table-header-check"><a href="#"><font color="white">Age</font></a></th>
<th class="table-header-check"><a href="#"><font color="white">Country</font></a></th>
</tr>
<?php
$files = glob('users/*.xml');
foreach($files as $file){
$xml = new SimpleXMLElement($file, 0, true);
echo '
<tr>
<td></td>
<form action="" method="post">
<td class="alternate-row1"><input type="radio" name="file_name" value="'. basename($file, '.xml') .'" />'. basename($file, '.xml') .'</td>
<td>'. $xml->name .'          </td>
<td class="alternate-row1">'. $xml->lastname .'</td>
<td>'. $xml->email .'</td>
<td class="alternate-row1">'. $xml->level .'</td>
<td>'. $xml->birthday .'</td>
<td class="alternate-row1">'. $xml->gender .'</td>
<td>'. $xml->age .'</td>
<td class="alternate-row1">'. $xml->country .'</td>
</tr>';
}
?>
</table>
</div>
<?php
if(isset($_POST['file_name'])){
unlink('users/'.$_POST['file_name']);
}
?>
<input type="submit" value="Delete" />
</form>
so as you can see i got radio value set has basename (xml file name) but from some reason it not working, any idea why is that?
Thanks in advance.