1

... preferably with PHP. I am new to Drupal.

My goal is to integrate a page into an already existing project which enables to give to users the possibility to book a Hotelroom or a flight ticket while the Administrator (me) then collects the submitted information and validates the choice in the backend.

I have done this countless of times from scratch in PHP with POST. But on Drupal, when I try to integrate HTML and PHP code into a new webform or new article page, it doesnt really render it.

2
  • Can you edit your question and explain what you have already tried and what the goal is. We will need some more information in order to help you. Commented Jan 13, 2017 at 8:29
  • I edited my comment. Thx.
    – Vasmir
    Commented Jan 13, 2017 at 8:37

2 Answers 2

1

After reading your question I would do the following:

Create a custom module with a custom block that holds the booking form. This way you can add the booking form on whatever page you like with the Context module for example.

The Drupal 7 example module can show and teach you how to create a block in a custom module.

2
  • Not 100% what I wanted but it does what I intend to do. I would also like to add that I just learned also that with the webform module you can send to users automated emails after they submit their form.
    – Vasmir
    Commented Jan 13, 2017 at 11:18
  • 1
    If you want to have the built-in functionality from a Webform then you'll need a custom module that alters the webform with function hook_form_FORM_ID_alter() and render your booking form where you want it. Commented Jan 13, 2017 at 11:40
1

By altering the Webform you can achieve. I know this is not the exact solution but you can achieve by doing some customization.

Alter webform and add php/Html code.
Implement the "hook_form_FORM_ID_alter".

function YOUR_MODULE_form_FORM_ID_alter(&$form, &$form_state, $form_id) {
    //check how you can use #submit/#validate to call custom function
    //Write your code in custom function. 
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.