homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

PHP form problem (I think)
HTML form pukes when submitted w/defaults, works fine otherwise

5+ Year Member

Msg#: 3846821 posted 12:35 am on Feb 11, 2009 (gmt 0)


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.




5+ Year Member

Msg#: 3846821 posted 12:39 am on Feb 11, 2009 (gmt 0)

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.



5+ Year Member

Msg#: 3846821 posted 12:47 am on Feb 11, 2009 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved