Note that there are some explanatory texts on larger screens.

plurals
  1. POFilter XML by elements
    primarykey
    data
    text
    <pre class="lang-php prettyprint-override"><code>&lt;?php $files = glob( 'docs/*.xml' ); if ( isset( $_GET['doctype'] ) == "all" ) { foreach ( $files as $file ) { $xml = new SimpleXMLElement( $file, 0, true ); echo' &lt;tr&gt; &lt;td id="'. $xml-&gt;doctype .'" name="'. $xml-&gt;doctype .'" class="mainTable"&gt;' . $xml-&gt;doctype . '&lt;/td&gt; &lt;td&gt;&lt;a href="viewdoc.php?docname=' . basename( $file, '.xml' ) . '&amp;username='. $xml-&gt;startedby .'&amp;myname='. $_SESSION['username'] .'"&gt;' . basename( $file, '.xml' ) . '&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;a href="viewprofile.php?name='. $xml-&gt;startedby .'"&gt;'. $xml-&gt;startedby .'&lt;/a&gt;&lt;/td&gt; &lt;td&gt;'. $xml-&gt;date .'&lt;/td&gt; &lt;td&gt;* * * * *&lt;/td&gt; &lt;td&gt;'. filesize( $file ) .'kb&lt;/td&gt; &lt;/tr&gt; '; } } else if ( isset( $_GET['doctype'] ) == "doc" ) { foreach ( $files as $file ) { $xml = new SimpleXMLElement( $file, 0, true ); // code filter the $xml-&gt;doctype by equal it to currect value - which i'm not sure how to do. echo' &lt;tr&gt; &lt;td id="'. $xml-&gt;doctype .'" name="'. $xml-&gt;doctype .'" class="mainTable"&gt;' . $xml-&gt;doctype . '&lt;/td&gt; &lt;td&gt;&lt;a href="viewdoc.php?docname=' . basename( $file, '.xml' ) . '&amp;username='. $xml-&gt;startedby .'&amp;myname='. $_SESSION['username'] .'"&gt;' . basename( $file, '.xml' ) . '&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;a href="viewprofile.php?name='. $xml-&gt;startedby .'"&gt;'. $xml-&gt;startedby .'&lt;/a&gt;&lt;/td&gt; &lt;td&gt;'. $xml-&gt;date .'&lt;/td&gt; &lt;td&gt;* * * * *&lt;/td&gt; &lt;td&gt;'. filesize( $file ) .'kb&lt;/td&gt; &lt;/tr&gt; '; } } ?&gt; </code></pre> <p>I got few <code>&lt;a&gt;</code> tags (same link, home.php), each one got different $_GET link (<strong>home.php?doctype=doc, home.php?doctype=all, etc..</strong>). Now i wish to filter each doctype by using if statement and check <code>$_GET['doctype']</code> if he equals to my value (assuming the value is word, excel, powerpoint, etc..).</p> <p>My question is: how can I filter doctype assuming that I equal $xml->doctype to one of my values?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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