Skip to main content
2 of 3
formatting

How to navigate the URL after booking page in Drupal 7

I have node content type for booking and created booking page in drupal 7 and same page is displaying error, confirmation and booking page. I am trying to split into three different pages(nodes) using same node--booking.tpl.php content type. I have custom booking.class.php that manages the booking process using two steps function prebooking and postbooking

After booking, I would like to redirect to xyz.com/booking-confirm if it's successfully booking and if it's error xyz.com/booking-error and currently, using xyz.com/booking for all actions.

What should I do? I am not sure, which option works. I have found this using some articles and stuck at this point.

  1. Should I use header to redirect it?

    header('Location: /booking-confirm'); 
    header('Location: /booking-error'); 
    
  2. Should I hook them in template.php?

    function MYMODULE_user_register_form($form, &$form_state) { $form_state['redirect'] = 'path/to/somewhere'; }

  3. Should I use drupal_goto to redirect it? it's in booking.class.php class?

  4. Should I use hook_init? It's in template.php or booking.class.php ?

I am not sure, which is correct option to figure it out. I would like to split the URL using same content type. Any approach to solve the issue.