One of the features I built into the Universal Contact Form last night is source tracking. This is Direct Marketing 101 — know where your efforts are producing the best returns.
So to invoke the form with source-tracking, you would just do this:
http://www.domain.com/UniversalContactForm.php?source=CLad2
In this case, we’re assuming that the source of the click into the form is a Craigslist posting.
Same thing, but as a unique form:
http://www.domain.com/UniversalContactForm.php ?action=Relocation&source=CLad2
(I had to break the line at the question mark to make it fit. Here and below, these should be seen as being all one line.)
In reality, though, you’re not going to want to go directly to the form. You’re going to want to hit a landing page that has the form as its call to action. And, in light of that, you’re going to “include” the form in PHP.
Alas, the variables passed from the URL in your Craigslist ad will be lost. You can’t live without the action variable, but you already know what to do about that: Hard code it.
And that’s essentially what you’ll do with the source variable, as well — except you’ll soft code both variables by passing them through.
So you invoke the form like this:
include ("http://www.domain.com/UniversalContactForm.php ?action=$action&source=$source");
The action variable is being received into the PHP variable $action on the way into the landing page, and source is being received into $source. When you do the “include,” you are transferring to another variable space, so you need to pack up the two variables and ship them along as you go.
But having done that, the form has access to them, so it behaves just as you want it to. You can daisy-chain like that as many times as you need to and the form will still receive the variables.