0

Beginner to PHP here. I'm designing a small website for an assignment with the goal of matching qualified job seekers with companies. The person looking for a job will fill out a form with their name, phone number, job they are looking for, college major, and the hours they wish to work. This information will be appended to a text file called "applicants.txt". Companies will fill out the same fields on a seperate page, except with what they are looking for in an employee as oppose to what they are looking for in a job. This information will be appended to a different text file called "jobOpenings.txt". I have done all of this successfully. What I am now struggling with is writing the PHP code to see if the information submitted by the job seeker matches the information submitted by the company.

3
  • 1. Don't use $_REQUEST. Use the proper superglobal instead. 2. Do you ever read from applicants.txt? Commented Oct 17, 2012 at 1:45
  • 2
    Out of curiosity, do you not have access to a database system that you can use? Commented Oct 17, 2012 at 2:03
  • Our teacher does not want us to use one since not everyone in class has experience using databases. Commented Oct 17, 2012 at 2:05

1 Answer 1

2

For the problem that you posted, your error is in: list($companyEmployer, $jobEmployer, $majorEmployer, $hoursEmployer) = explode("\t", $line); You are trying to explode the data based on 'tabs', while when you save the data, you separate the entries by comma's. Change explode("\t", $line) to explode(",", $line) to correctly read the data in to your variables.

Sign up to request clarification or add additional context in comments.

12 Comments

Thank you. I fixed that, but I'm still struggling to compare the elements between the two files. If there is a match between all relevant elements (job, major, hours) I want it to print out a given statement. If there isn't a perfect match I want it to print out an alternative statement.
With how your data is stored, I would suggest reading in all of the file to be compared to in to an associative array, and then reading the other file line-by-line and looping through the entire array of elements already stored comparing them and outputting what you need/want for each one. But, I'm not sure if you are comparing two files that are already fully formed to pull out matches, or if you do it as the user inputs data. The method would work either why, but implemented slightly differently.
Each time a potential employee submits his/her info, it will take him/her to a page that thanks them for submitting it and provides a link to another page that show the matches.
Why redirect them to find their matches? Why not do it on the submit page where their submitted information is readily available? You can thank them, add some formatting, and then say "Here are your matches:" type of thing. To get their matches, read in the employers file into an array, loop through each of them and compare it with what was submitted.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.