More php and mysql questions
There seems to be a problem w/ the code at the bottom of the following tutorial page:
AND, I actually copied and pasted this time, replacing the 3 dots w/ the correct head and title tags at the top of the listing. Also, I corrected the variable accessing methods from say $var to $_GET[var] or $_POST[var] where necessary.
Anyway, the code displays the JokeText column of the jokes.Jokes table, but adding a joke to the db is a problem.
When the "Add a Joke!" link is clicked, we're taken to the url http://foo.org/foo.php?addjoke=1, which is fine and dandy, but when you click the submit value, we're again taken to the same url, never exiting the outer php 'if' statement, and thus never adding the joke to the db, 'cause it's the 'else' that's supposed to take care of that.
One solution is to place the form on the bottom of the initial page, so that it's always there, separate from the php logic, but I was wondering if there's another way, using which would preserve the way the app behaves: giving the add-a-joke form only when clicking on the "Add a Joke!" link, and then taking you 'back' to the page that displays the contents of the db.
Here's the code, corrected to work w/ php4 (CORRECTED as in it gives no SYNTAX errors, but the PROBLEM I outlined in my first post still EXISTS):
|All times are GMT -5. The time now is 06:30 PM.|