All I need to do is have a form that does this:
- User enters postcode in text box
- Upon submit user is redirected to mysite.com/[user postcode]
That's it! I know validation etc. would be desirable as well, but I just need to get this working for now. I don't mind if it's harcoded or utilises the Drupal form API (actually I'd prefer the former!).
I know this is dead simple, but unfortunately I'm coming from a front-end background and have a bit to learn about this sort of thing :(
Cheers!
Creating forms in Drupal is fairly easy once you get the hang of it. I would recommend reading the following link. http://drupal.org/node/751826 It gives a good overview of how to create the form.
In the _submit hook, you can then redirect to the appropriate page by setting
$form_state['redirect']
.This is assuming of course that you already have the hang of creating custom modules. If you need more info on that, go here.
The Drupal Form API -is- dead simple and its something you need to learn as a developer eventually. Might as well jump in and do it through the API since its not too hard, what you are trying to do.
This is pretty easy with the Form API and a custom module. You'll build a form using the Form API and add a submit handler that changes the redirect for the form to whatever you'd like. Finally, you'll need to create a way to access the form (either by creating a menu item or by creating a block).
Here's an example that implements a form like you want: you'll want to peruse the Form API reference to see all the options you have when building a form. It also provides two ways to access the form:
hook_menu()
to provide a page for the form athttp://example.com/test
hook_block()
to provide a block containing the form that you can add and move around on the block administration page.Example code:
More info:
hook_menu()
API referencehook_block()
API referencehook_block
in Drupal 6