Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP form problem (I think)

HTML form pukes when submitted w/defaults, works fine otherwise



12:35 am on Feb 11, 2009 (gmt 0)

5+ Year Member


The problem: I have a PHP form that queries a local MySQL database and returns a (fairly large, in some cases) dynamically generated page (think 500 school listings - max). There are a number of fields that $_POST their values to the results page, and I double checked to make sure all the defaults options are marked: selected="selected".

It works fine with any combination of search criteria I can think of, EXCEPT leaving everything on the defaults. The result there is that 1) it queries MySQL properly and logs the proper number of results in the database, which leads me to believe that $_POST is working just fine.

BUT - it refuses to display the results. It renders part of the page, stopping at a dynamic piece just above where it would be processing the results.

The results set with all defaults is, as you might expect, the largest, but this was working fine until today. Other things that happened - moved to a new VPS yesterday (new Apache/PHP/MySQL, but I think all are up to date), added some data to the database and moved some fields around (but no obvious relation to the query in this case).

It is still capturing the default criteria and using them to search MySQL just fine, but it won't display the results.

Any ideas?..... this issue may be part HTML as well.... not sure.



12:39 am on Feb 11, 2009 (gmt 0)

5+ Year Member

To be clear - this worked fine after I moved the site. It started having problems when I imported some data into MySQL - but still returns the proper number of results.

Could there be an issue with data corruption of some sort? I checked the MySQL tables and all appears well.



12:47 am on Feb 11, 2009 (gmt 0)

5+ Year Member

Do you have die reason codes incuded in the code? This could be a handy tool in diagnosing the problem.

If you have re-ordered the fields, make sure the SQL query reflects the order.

When having a problem like this, I often take out the SQL part and put it into a seperate file. Test the two parts independently. See if it's the HTML or the PHP that's messing things up.

Another trick I use is to 'comment-out' all the PHP lines and then un-comment them one at a time until it stops working. Then you have found the line with the problem.


Featured Threads

Hot Threads This Week

Hot Threads This Month