title: html form onclick check if file exists
body: <p>I have a form containing one single input. Is there any way to check if a text file is existing with the same name as entered in the input field , when clicking on "submit"? So if you click on "submit", it should check if the text you typed in matches a file in a certain dir with end ".txt". If it exists, there should be an alert, if not, the form should be processed further.</p>
  
  <p>Edit:
  As it seems to be quite hard to answer a few more details:
  There is a form looking like this:</p>
  
  <pre><code>&lt;form action="&lt;?php echo 'create-page.php' ?&gt;" method="post"&gt;
  &lt;input type="text" name="newpage" value=""  /&gt;&lt;br&gt;
  &lt;input type="submit" name="submit" value="Save"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>If you cick on "submit", the script should check if a .txt file in the dir /example/ is existing with the name you just typed in in to the  
  If yes, there should be the alert "File found", if not, the form file be submitted.
  Hope this is more clear now...
  I think something like a php function should be fired. But how?</p>