Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
How to pass referrering url to form submission page.
Old 12-08-2006, 04:48 PM How to pass referrering url to form submission page.
Skilled Talker

Posts: 64
Name: Timothy Nerbonne
Trades: 0
What I want to do is to have a form on my website that allows users to report errors or problems with the website. In order for it to be effective, I want the referring url to be automatically included. That way, if they forget or something like that, I still have the url of the page where they came from that the error was supposedly on. I would want this field to be visible so that the user can see it is being included, but if possible, not allow them to change it.

Anyone know how to do this?

Thanks.

- Tim
nerbonne is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-08-2006, 09:01 PM Re: How to pass referrering url to form submission page.
blackhawkpowers's Avatar
Ultra Talker

Posts: 313
Name: Dustin
Location: GA
Trades: 0
you're going to have to use php for this although the code is simple it looks something like....
HTML Code:
<form action="post" method="somepage.php">
<input type= "text" name="name">
<input type= "hidden" 
name="referer" value="<? $_SERVER['HTTP_REFERER'];  ?>">
<input type="button" value="submit" name="submit">
</form>
hope this helps...... just remember your server has to have support for php for this to work.
__________________
A patch is a piece of software which replaces old bugs with new bugs.

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
blackhawkpowers is offline
Reply With Quote
View Public Profile Visit blackhawkpowers's homepage!
 
Old 12-09-2006, 04:35 PM Re: How to pass referrering url to form submission page.
Novice Talker

Posts: 6
Name: Jon
Trades: 0
blackhawkpowers is leading you in the right direction - if your server is not running PHP, it is more than likely running some other type of server-side language which should definitely be able to pull the referring URL.
__________________
Jon - Albany NY

Please login or register to view this content. Registration is FREE
and
Please login or register to view this content. Registration is FREE
shockent is offline
Reply With Quote
View Public Profile
 
Old 12-11-2006, 02:47 AM Re: How to pass referrering url to form submission page.
Skilled Talker

Posts: 64
Name: Timothy Nerbonne
Trades: 0
Well, I must be unclear on how to actual incorporate this code. It seems like the code provide would output the referrer to a php page, but I need it passed to a formmail cgi program so it can be emailed to me.

Code:
<form method="post" action="scripts/problem_report/formal.cgi">
<input type="hidden" name="subject" value="Error Report">
<input type="hidden" name="referer" value="<? $_SERVER['HTTP_REFERER']; ?>"
<table width="100%" cellspacing="13" border="0">
 <tr>
  <td align="center" colspan="2"><strong>Please tell us about the problem or error that you encountered. The page with the error is automatically reported so you do not need to specify what page it was on. </strong></td>
 </tr>
 <tr>
  <td align="right">Your Name</td>
  <td align="left"><input type="text" name="name" maxlength="70" size="45">
  (Optional)</td>
 </tr>
 <tr>
  <td align="right">Email Address</td>
  <td align="left"><input type="text" name="email" maxlength="70" size="45"> 
  (Optional) </td>
 </tr>
 <tr>
  <td align="right">Error Details</td>
  <td align="left"><textarea name="comments" wrap="virtual" rows="10" cols="40"></textarea></td>
 </tr>
 <tr>
  <td colspan="2">&nbsp;</td>
 </tr>
 <tr>
  <td align="center" colspan="2"><input type="submit" value="Email this Message"></td>
  </tr>
  </table>
  </form>
nerbonne is offline
Reply With Quote
View Public Profile
 
Old 12-11-2006, 04:00 AM Re: How to pass referrering url to form submission page.
Skilled Talker

Posts: 64
Name: Timothy Nerbonne
Trades: 0
I found Matt's formmail script which supposedly supports the HTTP_REFERER variable at:

http://www.scriptarchive.com/readme/formmail.html

But for the life of me, I can't get it to work on my server. I keep get Server Misconfiguration errors. I've set the permission to 755 and checked to make sure that my perl path is correct. I don't know what else to do.

Any suggestions?
nerbonne is offline
Reply With Quote
View Public Profile
 
Old 12-11-2006, 07:37 AM Re: How to pass referrering url to form submission page.
blackhawkpowers's Avatar
Ultra Talker

Posts: 313
Name: Dustin
Location: GA
Trades: 0
sorry I should have been a bit more clear my example of the script above will work but you do have to save it as *.php and not *.html . If you are doing this and the above scripts do not work then your server probably does not have php. if you want to see if it has php you can simply make a new page named test.php and inside it put
PHP Code:
<?
phpinfo
();
?>
then view the site if it gives loads of information then php is installed and working properly on the system
__________________
A patch is a piece of software which replaces old bugs with new bugs.

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
blackhawkpowers is offline
Reply With Quote
View Public Profile Visit blackhawkpowers's homepage!
 
Old 12-11-2006, 03:34 PM Re: How to pass referrering url to form submission page.
Skilled Talker

Posts: 64
Name: Timothy Nerbonne
Trades: 0
My server supports php.

My server supports cgi.

Neither of these are the problem. The problem is that when I try to pass your code to my formmail cgi script, it breaks the cgi program and I never get the email. If I remove your code, my cgi program functions properly and I receive my email.

Let me rephrase the question.

How can I make a page that has form fields, and one field called referrer is already filled in. I know it is possible, I saw it on one website but I was too stupid to bookmark it.

Thanks for your help.
nerbonne is offline
Reply With Quote
View Public Profile
 
Old 12-11-2006, 04:28 PM Re: How to pass referrering url to form submission page.
blackhawkpowers's Avatar
Ultra Talker

Posts: 313
Name: Dustin
Location: GA
Trades: 0
You wouldn't have been able to tell really from that other site anyway since it will be a server side script but your form could look like this....
HTML Code:
<form action="post" method="somepage.php">
<input type= "text" name="name">
<input type= "text" 
name="referer" value="<?php $_SERVER['HTTP_REFERER'];  ?>">
<input type="button" value="submit" name="submit">
</form>
although it's pretty much the same code I gave you before... just make sure to save this page as form.php and the processing page needs to be set to recieve the variable "referer"
__________________
A patch is a piece of software which replaces old bugs with new bugs.

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
blackhawkpowers is offline
Reply With Quote
View Public Profile Visit blackhawkpowers's homepage!
 
Old 12-11-2006, 05:24 PM Re: How to pass referrering url to form submission page.
Skilled Talker

Posts: 64
Name: Timothy Nerbonne
Trades: 0
Tried that, but the field doesn't populate. Here is the form. http://www.nbshosting.info/problem_report.php
nerbonne is offline
Reply With Quote
View Public Profile
 
Old 12-11-2006, 05:45 PM Re: How to pass referrering url to form submission page.
blackhawkpowers's Avatar
Ultra Talker

Posts: 313
Name: Dustin
Location: GA
Trades: 0
crap mybad it's the same error there that I had in the first code I just wasn't paying attention and missed it. we need to echo the results so here is the code and I tested it this time and will give the expected results so sorry for the bad bit of info up there.

HTML Code:
<html><body><form action="post" method="somepage.php">
<input type= "text" name="name">
<input type= "hidden" name="referer" value="
<?php 
if (isset ($_SERVER['HTTP_REFERER'])) echo $_SERVER['HTTP_REFERER'];  
if(!isset($_SERVER['HTTP_REFERER'])) echo "user went direct"; 
?>
">
<input type="button" value="submit" name="submit">
</form></body></html>
that will work
__________________
A patch is a piece of software which replaces old bugs with new bugs.

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
blackhawkpowers is offline
Reply With Quote
View Public Profile Visit blackhawkpowers's homepage!
 
Old 12-12-2006, 12:46 AM Re: How to pass referrering url to form submission page.
Skilled Talker

Posts: 64
Name: Timothy Nerbonne
Trades: 0
Wow, thank you very much. It definetly led me in the right direction.

However, since someone else may read this post and find it helpful, I will post the corrected copy of the code.

But seriously, thanks. You saved me.

Code:
 
<html>
<body>
<form action="somepage.php" method="post">
Name: <input type= "text" name="name"><br>
<input type= "hidden" name="referer" value="<?php if (isset ($_SERVER['HTTP_REFERER'])) echo $_SERVER['HTTP_REFERER']; if(!isset ($_SERVER['HTTP_REFERER'])) echo "user went direct"; ?>">
<input type="submit" value="Email this Message">
</form>
</body>
</html>
nerbonne is offline
Reply With Quote
View Public Profile
 
Old 12-12-2006, 01:48 AM Re: How to pass referrering url to form submission page.
Skilled Talker

Posts: 64
Name: Timothy Nerbonne
Trades: 0
Does this look correct to include the users IP address?

<input type= "hidden" name="referer" value="<?php echo 'REMOTE_ADDR' ?>">
nerbonne is offline
Reply With Quote
View Public Profile
 
Old 12-12-2006, 09:26 AM Re: How to pass referrering url to form submission page.
blackhawkpowers's Avatar
Ultra Talker

Posts: 313
Name: Dustin
Location: GA
Trades: 0
close
<input type= "hidden" name="referer" value="<?php echo $_SERVER['REMOTE_ADDR'] ?>">
__________________
A patch is a piece of software which replaces old bugs with new bugs.

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
blackhawkpowers is offline
Reply With Quote
View Public Profile Visit blackhawkpowers's homepage!
 
Old 12-12-2006, 09:07 PM Re: How to pass referrering url to form submission page.
Skilled Talker

Posts: 64
Name: Timothy Nerbonne
Trades: 0
Works great, thanks.
nerbonne is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to pass referrering url to form submission page.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.44661 seconds with 12 queries