PDA

View Full Version : MySQL: Getting data via a form


flameproof
12th September 2009, 10:26
I have a simple static mysql DB and I like to display filtered data, so that a user can filter for certain data.

When I write the php like that I get the desired result:

$query="SELECT * FROM ccl WHERE thick >= 1 AND thick <= 2 ORDER BY thick, width ASC";


However, I like the use to input min/max numbers via a form. How can I do that?

Any link to a page that explains simple php form handling is appreciated too.

falko
13th September 2009, 16:50
If the form uses action="GET", then the values of the form are in the $_GET array; if you use action="POST", the values are in the $_POST array.

flameproof
14th September 2009, 03:44
If the form uses action="GET", then the values of the form are in the $_GET array; if you use action="POST", the values are in the $_POST array.

Thanks for the hint.

In the meantime I played a lot around the script. I found 2 nice freeware tools which I like to share, at least for those with limited php knowledge:

phpFormGenerator
http://phpformgen.sourceforge.net/

This one creates php forms online. But that's only for input forms, or to create forms, not to search or browse them.

PHP Generator for MySQL
http://www.sqlmaestro.com/products/mysql/phpgenerator/ (not free, but 30 days full function trial)

This finally can do everything. I guess this output I can change to what I actually want.