Note that there are some explanatory texts on larger screens.

plurals
  1. PODeleting xml file using radio value
    text
    copied!<p>i using php to delete file, but i got table loop like this:</p> <pre><code> &lt;table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table"&gt; &lt;tr class="bg_tableheader"&gt; &lt;th class="table-header-check"&gt;&lt;a id="toggle-all" &gt;&lt;/a&gt; &lt;/th&gt; &lt;th class="table-header-check"&gt;&lt;a href="#"&gt;&lt;font color="white"&gt;Username&lt;/font&gt;&lt;/a&gt; &lt;/th&gt; &lt;th class="table-header-check"&gt;&lt;a href="#"&gt;&lt;font color="white"&gt;First Name&lt;/font&gt;&lt;/a&gt;&lt;/th&gt; &lt;th class="table-header-check"&gt;&lt;a href="#"&gt;&lt;font color="white"&gt;Last Name&lt;/font&gt;&lt;/a&gt;&lt;/th&gt; &lt;th class="table-header-check"&gt;&lt;a href="#"&gt;&lt;font color="white"&gt;Email&lt;/font&gt;&lt;/a&gt;&lt;/th&gt; &lt;th class="table-header-check"&gt;&lt;a href="#"&gt;&lt;font color="white"&gt;Group&lt;/font&gt;&lt;/a&gt;&lt;/th&gt; &lt;th class="table-header-check"&gt;&lt;a href="#"&gt;&lt;font color="white"&gt;Birthday&lt;/font&gt;&lt;/a&gt;&lt;/th&gt; &lt;th class="table-header-check"&gt;&lt;a href="#"&gt;&lt;font color="white"&gt;Gender&lt;/font&gt;&lt;/a&gt;&lt;/th&gt; &lt;th class="table-header-check"&gt;&lt;a href="#"&gt;&lt;font color="white"&gt;Age&lt;/font&gt;&lt;/a&gt;&lt;/th&gt; &lt;th class="table-header-check"&gt;&lt;a href="#"&gt;&lt;font color="white"&gt;Country&lt;/font&gt;&lt;/a&gt;&lt;/th&gt; &lt;/tr&gt; &lt;?php $files = glob('users/*.xml'); foreach($files as $file){ $xml = new SimpleXMLElement($file, 0, true); echo ' &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;form action="" method="post"&gt; &lt;td class="alternate-row1"&gt;&lt;input type="radio" name="file_name" value="'. basename($file, '.xml') .'" /&gt;'. basename($file, '.xml') .'&lt;/td&gt; &lt;td&gt;'. $xml-&gt;name .'&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&lt;/td&gt; &lt;td class="alternate-row1"&gt;'. $xml-&gt;lastname .'&lt;/td&gt; &lt;td&gt;'. $xml-&gt;email .'&lt;/td&gt; &lt;td class="alternate-row1"&gt;'. $xml-&gt;level .'&lt;/td&gt; &lt;td&gt;'. $xml-&gt;birthday .'&lt;/td&gt; &lt;td class="alternate-row1"&gt;'. $xml-&gt;gender .'&lt;/td&gt; &lt;td&gt;'. $xml-&gt;age .'&lt;/td&gt; &lt;td class="alternate-row1"&gt;'. $xml-&gt;country .'&lt;/td&gt; &lt;/tr&gt;'; } ?&gt; &lt;/table&gt; &lt;/div&gt; &lt;?php if(isset($_POST['file_name'])){ unlink('users/'.$_POST['file_name']); } ?&gt; &lt;input type="submit" value="Delete" /&gt; &lt;/form&gt; </code></pre> <p>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?</p> <p>Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload