Forum Moderators: open
I'm designing a site for a travel company. They already have a booking engine but they want a section on the site where they could post in-house products (each product on it's own full page). There is NO CMS for this, I'm building them in plain HTML. So, if a client is interested in one of the packages, they would click the "Reserve now" button and are taken to the "reservation" form. My problem is that I don't want to build an individual form for each page, I'd rather have one central form that somehow catches or records the referring URL (or package info) so that when the form submits, we will know which package they want to reserve.
Can anyone help me?
I wrote a web stats package which uses the referer and most of the time it works, however sometimes it's blank. Doesn't seem to matter what OS or what Browser, but I think some firewalls can block it. It's about 96% reliable I think.
If I were to do this with PHP, would that work WITHOUT me having to change my HTML pages? I just want the form to submit a hidden field which records the referrer URL (previous page they were on). Can a PHP form do that? And if so, does anyone know of any ready-made scripts available (sorry,I'm not a coder - just a designer) =)
Also, take it from experience- you/they will definitely want some sort of CMS developed. Travel products (or at least some of the related information) change over time, and hand editing HTML files is not productive.
<a href="reserve.php?ref=http://www.example.com/product1.html>Book Now</a>
for example, make the link to the reservation form something like this
www.example.com/reservation-form.html?city=nameofcity&hotel=nameofhotel
In my case the form is on the homepage, which is an html file. If I would put some php code in it, I'd have to change the file extension and lose all search engine rankings!
Is this really (sending referring URL in a form) not possible using Javascript?
I'm using the following Javascript code, but it doesn't seem to work:
<!-- this goes in the page header -->
<script>
function start() {
var ref = document.getElementById('httpref');
ref.value = document.referrer;
}
onload = start;
</script>
And this line in the form:
<input type="hidden" id="httpref" value="">
Is there something wrong with the code?
Thanks in advance.