-- Drupal and Web Development

Notice: this post was last updated 5 years 11 weeks ago so it might be outdated. Please be cautious before implementing any of suggestions herein.

Using prepopulate on Drupal 7's contact form

Say I have several categories in my Drupal contact form, and I'd like to create a link to the contact form, but with one of those categories preselected, and, while I'm at, prepopulate the subject and message fields, here's how I go about it.

(1) install and enable the prepopulate module.
(2) Figure out which category (recipient) you want to preselect by finding its ID on the page
(3) Say your message is "this is my message" and your subject is "I'd like some more info & pricing please": pass those two strings in php's urlencode() function.
(4) Put everything in the following format:



If our cid (category ID) is 14, this would give us the following path

Note that if you want several lines on your message, a newline is encoded as %0A (for some reason I can't get urlencode() to generate this for me)