I'm not quite sure where to start with this one... I have a .csv file with two columns.
User, computer name john, computer1 jane, computer2
I've got an html page that can be seen below:
<HTML>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
<HEAD>
<TITLE >
User Login
</TITLE>
<form name="input" method="post"
action="/tinkering.php">
<p><label for="firstname">User Name: </label>
<input type="text" name="fname" id="fname" /></p>
<p><label for="idnumber">Password: </label>
<input type="text" name="idnumber" id="idnumber" /></p>
<p><input type="reset" name="reset" value="reset" />
<input type="submit" name="submit" value="submit" />
</form>
</HTML>
I also have the following php script
<?php
if (isset($_POST['submit'])) {
$userInput = $_POST['userInput'];
$array = file('test.csv');
$match_found = false;
foreach ($array as $line) {
$pieces = explode(",",$line);
if ((trim($pieces[0]) == $userInput)) {
$match_found = true; break;
}
}
if($match_found){
echo 'Your computer name has been found...';
## not sure how to create variable here,but ideally
## that would happen at this point, and the user would continue with login
## process...
} else {
echo 'Could not find computer name...';
}
}
?>
however, when i go to the html form, fill out my information, and click 'submit' I receive the following message:
_
Your file was not found
It may have been moved or deleted.
ERR_FILE_NOT_FOUND
_
I'm sure i'm missing something silly, but I'm at a loss as to what i need to do to get this up and running.
Honestly i'm not even sure if i'm even going in the right direction.
Thanks in advance for any assistance you can provide on this issue.