I added a simple form with one input field and a submit button. The form's action was set to $_SERVER['PHP_SELF']. When the submit button is pressed, the user is sent back to the front page. Why doesn't it stay put? And how do I ensure that it does?

Comments

dman’s picture

PHP_SELF is the front page. Always
Everything goes through index.php. If you are using clean URLs, your request really becomes index.php?q=your/pretend/url

Sorry, you'll have to learn the Forms API.

... or avoid enlightenment altogether and add <input name="q" value="$GLOBALS['q']" > or something messy like that.

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

chx’s picture

simply do not set action. and read http://api.drupal.org/api/HEAD/file/developer/topics/forms_api_reference... and http://drupal.org/node/33338 .
--
The news is Now Public | Drupal development: making the world better, one patch at a time.

--
Drupal development: making the world better, one patch at a time. | A bedroom without a teddy is like a face without a smile.

Raymondo’s picture

I prefer not to set action. Thanks for that.

I have one, small form to put together. I don't see the advantage of learning the forms api for that one form. It's not something I'm likely to need either as I just help out on the drupal site belonging to a small, community-based organisation. I'll leave enlightenment to others!