By amira on
hi all,
iam little bit new in drupal ...i hope anyone help me in my problem..?
i have a form that is supposed to submit to a page that shows some data from a table in db,
the problem is: i want to redirect my current page -when submittg the form - to the page which return data from db , i read alot on drupal API like drupal_submit_form and drupal_go_to() the second function need path where it is supposed to go but actually i didnot have any paths , i have a code in php code.
hope anyone help me plzzzzzzzz
thanks for advance
Comments
You'll need to define a path
You'll need to define a path for the output page in your module's hook_menu (http://api.drupal.org/api/function/hook_menu) implementation. Then you can use the #redirect attribute (http://api.drupal.org/api/file/developer/topics/forms_api_reference.html...) in the form's FAPI definition.
another question?
thank u Barrett ,
here is what i made ..............but no change
any suggesstions..........?
thanks for advance
Ahhh...Well, there are a
Ahhh...Well, there are a couple problems here. Lets start with your menu function. A return statement in a function halts processing of the function, so the $form... line you have in there will never be processed. The function will get to the return $items; line and then processing passes out of the function.
That aside, the $form['#redirect'] is meaningless in the way you're using it. First, it shouldn't be in the menu function. The menu has no reference to the form you're talking about. That line should go in the form definition function...which leads to the next problem. You're defining the form via plain old html in the block function instead of using the FAPI.
How to revamp it to use the FAPI would take some time. I'd suggest googling around for FAPI tutorials. You could also check out Pro Drupal Development and Learning Drupal 6 Module Development. Both of those have really good coverage of the FAPI.
Good luck
thanks Barrett so much, i
thanks Barrett so much,
i tried checking some tutorials and that is what i get but i have a problem in show button which is i cannot see any of records that i tried to retrieve....so any help to do that...
thanks in advance