Page 1 of 1

Problem with Form variables

Posted: Thu Feb 19, 2004 11:38 am
by nickweavers
I am trying to create a page to collect some information via a form that is then used to build an sql query, perform the query and show the results.

I want to do this all on the same page so I am using $PHP_SELF in the form action field.

The bit I'm getting confused with is the clearing of the form variables and I guess it's due to my need to have the search form always availabe at the top of the page to allow another search to be performed.

The Form consists of two selection lists: one for a "category" and another for a "region" and the chosen item are passed back into $PHP_SELF using the GET method at the moment so I can see what is going on.

I seem to be getting strange problems with the $region and $category variables not being cleared. I know this isn't rocket science but it's twisting MY brain up.

Are there well know techniques for ensuring good design of this sort off application?

Do I need to use a small state machine here or should I be able to do it all stateless (apart from the $_GET variables).

When is the best time to reset all of the form variables? Should I transfer the $_GET values to intermediate local variables after the submit and clear the $_GET's to avoid them persisting too long?

Any help much appriciated as long as you explain it very clearly... I'm pretty new to this.

Cheers,
Nick.

Posted: Thu Feb 19, 2004 11:42 am
by ol4pr0

Code: Select all

{$_SERVER['PHP_SELF']}
http://www.php.net

Posted: Thu Feb 19, 2004 11:44 am
by nickweavers
Better still... is there anything out ther in Open Source land that I can use to do what I'm tring to do?????

Posted: Thu Feb 19, 2004 11:46 am
by ol4pr0
http://www.hotscripts.com ?

=>doGoogleSearch ;-)