Hi I'm hoping to include script on my site to capturer the referrer information when a visitor completes a contact form. Previous question: http://forums.digitalpoint.com/showthread.php?t=88633&highlight=referrer+form I already use both the free stats package - statcounter.com (which is great for up to the minute information) and Google Analytics (which is normally 12-24 hours behind but far more comprehensive) I'd like the contact form (which is on every page) to include referrer information. Here's the form code: <form action="ok.php" method="POST"> <label for="sender_name"><strong>Your Name</strong></label><br /> <input name="sender_name" size="17" type="text" /><br /> <br /> <label for="company"><strong>Your Company</strong></label><br /> <input name="company" size="17" type="text" /><br /> <br /> <label for="sender_email"><strong>Your E-Mail Address</strong></label><br /> <input name="sender_email" size="17" type="text" /> <br /> <br /> <label for="telephone"><strong>Telephone</strong></label><br /> <input name="telephone" size="17" type="text" /><br /> <br /> <label for="message"><strong>Enquiry</strong></label><br /> <textarea name="message" rows="10" cols="13"></textarea> <input name="page" type="hidden" value="about page"> <div align="left"> <br /> <input type="submit" value="send enquiry" /> </div> </form> Code (markup): and here's some of the ok.php script $filestring="$_POST[sender_name] $_POST[message]"; $findme = 'MIME-Version'; $pos1 = strpos($filestring, $findme); $findme = '</a>'; $pos2 = strpos($filestring, $findme); $findme = ' < / a> '; $pos3 = strpos($filestring, $findme); if (($pos1 === false)&&($pos2 === false )&&($pos3 === false)){ $to = "info@cavaliermailing.com"; //mail string $msg = "Enquiry from\t$_POST[page]\n"; $msg .= "Name:\t$_POST[sender_name]\n"; $msg .= "E-mail:\t$_POST[sender_email]\n"; $msg .= "Telephone:\t$_POST[telephone]\n"; $msg .= "Company:\t$_POST[company]\n"; $msg .= "Message:\t$_POST[message]\n"; //set up e-mail $subject = "Message from website\n"; $mailheaders = "From:\t$_POST[sender_email]\n"; $mailheaders .= "Reply to:\t$_POST[sender_email]"; //send mail mail($to, $subject, $msg, $mailheaders); echo "<strong>Thank you\t$_POST[sender_name] for your message. We will get in touch with you shortly.</strong>"; } else { echo "Sorry the string <strong>'$findme'</strong> was found in your message and has not been sent.<br /><br />Please resubmit or call 01603 720303"; } PHP:
Google analytics is your friend on this one. Add a small bit of code to the page people see after you submit your form and you can use google analytics to track it. http://www.google.com/support/analytics/bin/answer.py?answer=27203
I'm not quite sure what you mean - can you explain? Sure - I already have the standard Analytic code on every page - and I can track back if someone has completed a form (24 hours later) but how can I get it to carry the information which was used in the form? CW