Hello folks,
My name is JP Honeywell and in the last month or so I have been told to learn & use PHP/MySQL for a web-enabled work ticket database project due by Christmas. As bad as that sounds, I'm pretty close to done - I hope.
I used the address book example from the book "Professional PHP Programming" by Wrox Press Limited. I got that application to work without error and liked the simplicity of its design.
I have uploaded modules on my webpage http://www.artic.edu/~jhoney/php/ that I am using so that anybody offering to help me can see as clearly as possible what I am dealing with.
The application begins with main.php3. As you can see, there's not much to it. If it's a new session the choice variable will not have been assigned and it will execute the top part of the code. This executes three functions in sequence. Every function called on this page is located in the common.php3 file. The GenerateHTMLHeader function just generates the generic code that will be at the top of every HTML page. The GenerateFrontPage function generates the two buttons that the user can choose from to either search for work tickets or add a new work ticket. The GenerateHTMLFooter function generates the generic code that will be at the bottom of every HTML page.
The problem I am experiencing is manifested when the user clicks on either the SEARCH or ADD button. Once again, the GenerateHTMLHeader and GenerateHTMLFooter functions are used before and after a different function; the GenerateHTMLForm function. I should note that this function generates the form which is used to search for records, add a new record, and also to modify a record. You can see what the screen with the error messages looks like in the screenshot.gif
The problem is certainly in the GenerateHTMLForm function and stems from my attempt to incorporate drop-down fields and textarea fields. Here's what I'm trying to do.
Starting on line 94 of common.php3, I am trying to create drop-down box for the Constituency field with the possibility of three or four values being displayed. If this form is being used to perform a search than we must allow for a blank value. If the form is being used to add or modify a record then we must not create a blank value in the drop-down list.
The same testing should be done for the building field, ticket status field, supervisor field, and trade field for the same reasons.
This constituency field is unique because the values that need to be displayed to the user are not the values that need to be passed on to the database. (None of the other fields are this way.) I feel fairly certain that the problem is being caused by my attempt to define a pair of arrays on lines 94 and 95. I have convinced myself of this because I am not defining any arrays for the building field or the department field and no error is being displayed in either of those fields. I'm probably doing the array thing wrong. Hopefully my documentation in the code makes sense. If it doesn't, let me know and I'll try to explain myself better.
I feel fairly confident that if I can solve the problem for one of the drop-down fields that will lead to the solution for the rest of the drop-down fields.
The description and worklog fields are both textarea fields. Apparently the problem on those two fields can be found on lines 338 and 482.
If somebody could help me out I would be much obliged.
Regards,
JP Honeywell
Acting Intranet Manager
The Art Institute of Chicago