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!
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/testhook_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_blockin Drupal 6