Hi
I need a module that allows users to apply for a course on a page, by clicking a Book Course button, that sends them to a page with a form that will contain all the course info from the course page the came from, so that people can book courses without having to fill information about the course. Not sure how to send information from one page to another.

Thanks for any help and I'm using D7

Comments

ayesh’s picture

Not sure about core contact pages. Perhaps http://drupal.org/project/prepopulate can do the trick.
Webform module, in other side a better alternative to core contact forms and you can make really cool forms with it, including autofilling values with $_GET parameters (So URL will look like example.com/book-course?cource=IELTS)

Polyspiral’s picture

Hi Ayesh

Thanks this might be the solution. Im using Webform, and I have a URL of booking-form?course=2 but when I put %get[key] it shows %get[key] in that field or if I put %get it shows nothing. Do I put this value in the Default value? What am I doing wrong?

Thanks again

vishantpoeran’s picture

Hi i got some info from:
http://drupal.org/node/164836
http://drupal.org/node/296453#webform-url-default

My url: test?course=html

I use a selectlist option. And i get a prefilled option with my url.

Here are my settings:
Default value: %get[course]

choosewisely’s picture

I'd add the following code to the bottom of your node.tpl.php (specify the content type of your courses):

<a href="/book-course&course=<?php print ($node->title); ?>">Book Now</a>

Then use vishantpoeran's solution above for the webform module. Make sure none of course title's have characters such as $ | ? | = etc.

*Edit: In fact use l() instead incase you change your aliases.

vishantpoeran’s picture

After that solution, i'm wondering how i can fill my selectlist in the webform with node titles form a specific content type. A user can select courses (nodes titles) in the form.

ayesh’s picture

Not sure about select lists - but some quick searches in webform issue queue should give more information.

Polyspiral’s picture

Hi and thanks

Still the same problem: when I put in the default values as %get[key] in the webform, when I try the URL .../content/booking-form?=1 it shows nothing in that field, when I put %get in the default value I get %get showing in the text field when I try the URL

How do I only show print ($node->title); ">Book Now in one content type? and the course code field is called: field_course_code, i tried print ($node->field_course_code); but it just says booking-form=Array

Thanks for all your help so far

Polyspiral’s picture

and shouldn't the address be

content/booking-form?=1

With a question mark

I read the pages you posted links to but I couldn't understand them, when he said [product] is he talking about a field name or a content type?

thanks

choosewisely’s picture

For your webform the default value should be %get[course] not %get[key].

Yes, it should be a question mark. It should look something like below:

content/booking-form?course=1

The field in your webform will now be prepopulated with the value of "1" if they arrive from the link above.

If you're looking for select lists you could always go down the route of Node Reference URL Widget rather than the webform module.

Polyspiral’s picture

Hi choosewisely, thanks, I have been putting in %get[course] but it wasn't working until I put in the link ?course=[field_course_code] Duh!
Putting that other code in the node.tpl.php didn't work.

Big thanks to all of the above that helped, really appreciated :)

philsward’s picture

Webform module, in other side a better alternative to core contact forms and you can make really cool forms with it, including autofilling values with $_GET parameters

For Drupal 7, I had to dig into an older site to remember how to do it, but:

1) Setup a field such as a text field
2) In the "Default Value", use the [current-page:query:?] token as found in the token browser.
3) Rename the token to something useful for your situation: [current-page:query:page_title]
4) Save the webform field

Now, when visiting the path of the webform you can use ?token_param=value to prefill the field you created.
For example: https://example.com/test-course?page_title=Introduction To Your Courses

From here, it might become a bit more complicated to take a dynamic page title and insert into the URL, but there are ways of doing it without code.