Note that there are some explanatory texts on larger screens.

plurals
  1. POIf i search trough my csv file the output comes serverval times
    primarykey
    data
    text
    <p>If I typing Test1 in my form the output is than 5x Test1, If I typing Test2 in my form the output is that 4x Test2 etc. How can I solve this problem? </p> <p>This is my csv file:</p> <p>"Naam"</p> <p>"Test1"</p> <p>"Test2"</p> <p>"Test3"</p> <p>"Test4"</p> <p>This is my search form: </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" type="text/css" href="test.css"&gt; &lt;title&gt;test&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container"&gt; &lt;div id="logo"&gt;&lt;/div&gt; &lt;div id="header"&gt; &lt;h1&gt;Test Test Test&lt;/h1&gt; &lt;/div&gt; &lt;div id="menu"&gt;&lt;/div&gt; &lt;div id="content"&gt; &lt;form action="csv.php" method="post"&gt; &lt;h3&gt;Voer je naam in:&lt;/h3&gt; &lt;pre&gt; Naam: &lt;input type="text" name="Naam"&gt;&lt;br&gt; &lt;input type= submit name="submit" value="Verzenden"&gt; &lt;/pre&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="footer"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>This is the output page:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" type="text/css" href="test.css"&gt; &lt;title&gt;test&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container"&gt; &lt;div id="logo"&gt;&lt;/div&gt; &lt;div id="header"&gt; &lt;h1&gt;Test Test Test&lt;/h1&gt; &lt;/div&gt; &lt;div id="menu"&gt;&lt;/div&gt; &lt;div id="content"&gt; &lt;form method="get"&gt; &lt;?php if ( !empty ( $_POST['Naam']) ) { $naam = $_POST['Naam']; $file_handle = fopen("Test.csv", "rb"); $found = false; while (!feof($file_handle) ) { $parts = fgetcsv($file_handle,4096,","); $file_arr = preg_split ( "/\n/" , $file_content ); foreach ( $file_arr as $item ) { if ( $parts[0] == $naam ) { $found = true; $resultaat = $parts[0]; } } $parts[0] = ucwords(strtolower($parts[0])); if ( $found ) { Print "Naam: ". $resultaat; echo "&lt;br&gt;"; } } if ( !$found ) { print "Not found"; } fclose($file_handle); } ?&gt; &lt;/div&gt; &lt;div id="footer"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    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.
    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