Homework 4 (NerdLuv) FAQ

Q: Why does my page say "file_put_contents: Permission denied" when I try to write a file?
A: You may have an issue with your file permissions on Webster. See the section of the spec about file permissions to learn how to fix it. Email your TA if you can't fix it.
Q: How do I validate my pages? I see a lot of errors when I click the W3C button on the "-submit" pages.
A: The W3C buttons don't work properly for pages that require form query parameters. Instead, View Source on the page output in your browser, and copy/paste that text into the W3C validator directly.
Q: Can a person have 0 matches? 1 match? A whole bunch? How should I handle each case?
A: Yes, it's possible to have 0 matches. See the Stewie Griffin example output on the web site. You should treat every case the same; you don't need a special case for 0 matches or 1 match. Just don't show any matches if the person doesn't have any.
Q: I think the list of matches in the expected output is wrong! I get more/fewer matches than you do.
A: You probably have a mistake in your code to check for a match. Read the instructions carefully. Common mistakes include not checking the match in both directions, demanding too many letters of the personality type be the same, etc.
Q: Can I assume that every person's name will be in the format "FIRST LAST"?
A: No. Every name will be a non-empty string, but some names are just one word ("Leeloo") and others have more than two words ("Rosie O Donnell", "Angry Video Game Nerd").
Q: What if the user types in bad data, empty data, data with funky characters in it, etc.?
A: We won't test for this. You may assume that the user fills out the entire form with valid non-empty values without special characters in them. (Though CSE majors have a validation feature where they check for invalid data.)
Q: How do I compare strings in PHP?
A: You can use ==, !=, <, >, etc. Or use functions like strcmp.
Q: My code says, "Fatal Error: Cannot redeclare (something)". Why?
A: You are include()ing the same thing twice. Change your include calls to include_once (which does nothing if that file has already been included before) or remove the second include call.
Q: My text boxes on the form look a bit narrower / wider than the ones in the expected output. But I am sure I used the size values from the spec. What is wrong?
A: Different versions of Windows, such as XP/Vista/7, may draw the text boxes at a different size. If you are certain that you used the size attribute values from the spec, you are probably okay. If you want to be sure, view your solution in the output comparison tool.
Q: What does this error mean? Fatal error: Maximum execution time of 30 seconds exceeded in /path/to/myfile.php on line #
A: It means you have an infinite loop in your code, so PHP timed out.
Q: Why does the file_exists function always return FALSE for me?
A: You might be using a bad file name/path string. Try printing it out to see its value. Also don't use a leading "/" character in the string, because that searches in the server's root directory. Don't pass a URL (http://...) to file_exists.
Q: What does this error mean? Parse Error: syntax error, unexpected $end in ... myfile.php on line #
A: You are missing a } or ) closing brace character. TextPad and other editors can do brace matching and highlighting to help you find the problem.
Valid HTML5 Valid CSS JavaScript Lint
This document and its content are copyright © Marty Stepp, 2013. All rights reserved. Any redistribution, reproduction, transmission, or storage of part or all of the contents in any form is prohibited without the author's expressed written permission.