Welcome to WebmasterWorld Guest from 54.221.28.179

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

http referer

making forms return to the referring page

     

hydrolix

9:19 pm on Sep 30, 2002 (gmt 0)



After reading a page, users can click thru to a feedback form. Once they have filled out the form, I would like the user to be taken back to the referring page AND the url of the referring page to be included in the email that is sent to me.

I think I've figured out I can use http referer but I don't know how to reference it in my form. Any ideas?

tedster

10:59 pm on Sep 30, 2002 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Welcome to WebmasterWorld, hydrolix.

This sounds more like a job for server-side scripting, especially including the referer in the email you get sent to you. So, I'm moving the thread over to the Scripting forum. I'm sure the folks that hang out there will be chock full of ideas!

jatar_k

12:16 am on Oct 1, 2002 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Welcome to WebmasterWorld, hydrolix

What scripting language does your form processor use?

For php I would use the $HTTP_REFERRER. You have to keep in mind that you may not always get a referrer from every browser. You could also pass it to the form. Put it in the form link on the page. You would have to script that as well. You could have a link like.

www.somedomain.com/feedback.html?page=article12

Something like that, but the actual implementation would have to do with what language you are using or have available.

hpche

3:21 pm on Oct 1, 2002 (gmt 0)

10+ Year Member



I would try not to rely on the http_referer variable if possible, as Jatar says it's not always that reliable.

Presuming it's PHP, you could do something like this:

On the original page


<a href="feedback.php?page=<?=$PHP_SELF?>">Comment on this page</a>

At the top of feedback page after they've filled in their comments (must be above all HTML and white space).


<?
if (isset($submit)) {
$comments = $_POST['comments'];
$comments .= "\n\nSent about the page $page";
mail ("me@example.com", "Subject", $comments);
header ("location: $page?sent=yes");
}
?>

You could then use the $sent variable to display a message that their comments have been successfully received. You might also want to do some checking to make sure the $page variable hasn't been tampered with.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month