There are two basic ways to create a pharma hack. One way is to simply redirect the user’s browser directly to the pharmacy site when they click on the hack created search results. They other way is to create a pharmacy page that comes from the hacked site but has links to the pharmacy page. Of these two basic ways the second way, a pharmacy page with links, is the most common.
Using HTML and setting the pages base to a second site with <base href= seems to be the most common way to create a pharmacy page on a hacked site. The HTML is coded in base64 or some other encoding and stored in the MySQL database to make it hard to find.