I'm a newbie to writing modules but I'm writing one that creates a new content type that creates a dynamic link to another page. Is there any way to pass a variable to the new page via the link?

My link is something like <a href="?q=node/add/newcontenttype&variable=123">The Link</a>

When I click on the link though, it goes to the 'create content' page. Any ideas?

Comments

dheeraj.dagliya’s picture

when you have a link like this ?q=node/add/newcontenttype&variable=123, Drupal breaks the url by '/' & then look for menu hook. In your case last argument is newcontenttyle&variabl=123, so it looks for an contenttype with this name and find none so it goes back one level and shows you Create content Page.

To pass variable you can use ?q=node/add/newcontenttype/123 and write code in your module to handle this argument.
You can write a call back for this url in your modules _menu hook.

Hope this will help you, if you have read about how to write a module.... else look for it in handbook.