Autoinclude some data into contact form.

Permalink
Is it possible to automatically put some data into form depending on refferal site, or link?

The case is - my client is travel agency, we make one page for each trip. Each trip has also some different dates, so we make on that page list of all dates to that destination, and by each date is "book a trip" button, but all that buttons lead to one contact form. Is it possible to fill in some fields automatically, depanding on which "book a trip" button users will click? It would be the best to fill in also destination and date, but anything would be super...

Any ideas?

MysteriousCleon
 
MysteriousCleon replied on at Permalink Reply
MysteriousCleon
Anyone?
Korvin replied on at Permalink Reply
Korvin
There are multiply ways you can do this:

1: _GET
<a href='http://mysite.com/?came_from=Derp'>Go to site from derp</a>
if (isset($_GET['came_from'])) {
    switch($_GET['came_from']) {
        case 'OtherSite': 
            echo 'You came from the other site';
            break;
        case 'Derp':
        case 'Default': 
            echo "You either came from Derp, or a place that I don't know";
        break;
    }
}

2: $_SERVER['HTTP_REFERER']
Check outhttp://php.net/manual/en/reserved.variables.server.php... , and use a similar switch-case statement for that.
MysteriousCleon replied on at Permalink Reply
MysteriousCleon
Thanks for answering, this is what I was looking for. Now there is only question if it can be used with standard form block.

Before I'll start experimenting how to use it in best way - maybe someone want to give me some clues?