0

I have created a website with two webpages. One webpage has an html form that allows a potential employee to submit their name, phone number, preferred job, college major, and preferred hours (part time or full time). The information is appended and saved into a text file called applications.txt. The other webpage has an html form that allows a company seeking employees to submit their company name, job opening, required college major, and required hours (full time or part time). This information is appended and saved to a text file called jobOpenings.txt.

Here is an example of what one line would look like from each file.
applications.txt:
Mike Adams,5551112772,Programmer,Computer Science,Full Time

jobOpenings.txt:
Google,Programmer,Computer Science,Full Time

The above example would result in a match. I've already succesfully written code to create the forms and append the info to the proper text files, but how do I use PHP to compare the two text files line by line to see if there is a complete match (between all elements EXCEPT the name, phone number, and company name). For each line from the jobOpenings.txt that matches with the line in applications.txt, I want it to print out something stating that it found a match. If there are no matches, I want it to state that there are no matches found. I've spent a great deal of time trying to figure this out, but with no luck. Can anyone help?

3
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by leviathan185
0

@Anonymous123

For each line from the jobOpenings.txt that matches with the line in applications.txt, I want it to print out something stating that it found a match. If there are no matches, I want it to state that there are no matches found. I've spent a great deal of time trying to figure this out, but with no luck. Can anyone help?

You need to used preg_match to match the strings.

Read this and there are some examples you can used from this

http://php.net/manual/en/function.preg-match.php

0

Does this need to be in a text file? Do you not have access to a database?

You would avoid a whole range of problems if you were able to put it all in a database...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.