Hi Forum,

I'm trying to wrap my head around what should be a fairly basic script, but I'm still rather new with the whole PHP & MySQL thing. If anyone is willing to help me out, I am happy to credit you and/or website in the code. Getting this up and running is my first concern.

Here are the details:
- index.php has a text field and a submit button; a visitor will enter their question into the text field, and click the submit button.
- a MySQL db has "tblAnswers" which stores a list of abstract answers. Fields are "answerID" and "answerText".
- when the form is submitted, a php script is run which randomly selects an answer from tblAnswers, inserts the visitor's question into another table in the db ("tblQuestions") along with the answer that was selected and the currrent date. Fields in tblQuestions are "questionID", "questionText", "answerText","questionDate".
- Finally, the web page must update to display the visitor's question along with the randomly selected answer.

Basically, it's kind of like a Magic 8 Ball script, but instead of an array declared in the PHP code, I want to have the answers stored in a database, as well as the ability to record all of the questions asked by visitors.

A few years ago, a developer created a basic script, but an upgrade to PHP5 has broken it. Even with my basic knowledge of PHP, I can tell that this script was not written with good standards, and the commenting in it is horrible. I'd really like to get something good and clean up there instead.

Thanks for anyone willing to help!
Mindy 🙂

    Write a Reply...