Webmaster Forum

Lionsanime Directory   High Bandwidth Dedicated Servers   V7N Directory
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Reply
 
LinkBack Thread Tools Display Modes
Old 08-10-2007, 02:04 PM   #1 (permalink)
Inactive
 
Join Date: 08-10-07
Posts: 5
iTrader: 0 / 0%
Latest Blog:
None

ricksterv4n1x8 is liked by many
Web form that auto fills in previously visited page

Currently I have about about 5 different "centralized" forms on our website from which about 50 or so product pages link to for people to request more information. The problem I have is that people view a product page, then click the "Contact Us" button to get to the form. They then leave a message that's very specific to that product WITHOUT mentioning or identifying the product they were talking about. I would like to have the form include the previously viewed page prior to filling out the form. Is that possible? If so, how can I implement something like that? Or is there a better solution I haven't thought of? I know I could create 50 individual forms but that's too much hassle to setup and maintain. Any suggestions would be greatly appreciated. Thanks
ricksterv4n1x8 is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 08-10-2007, 02:47 PM   #2 (permalink)
v7n Mentor
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania
Posts: 2,909
iTrader: 0 / 0%
Costin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web pro
I can bet your website is using php, isn't it?

if so, wait for the v7n php masters to log in and then you'll get your answer for sure!

__________________
JUNE - JavaScript Framework
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-10-2007, 03:18 PM   #3 (permalink)
Inactive
 
Join Date: 08-10-07
Posts: 5
iTrader: 0 / 0%
Latest Blog:
None

ricksterv4n1x8 is liked by many
Thanks. The site is a static html site but the form program I am using (Email Processor Pro) is a PHP program.
ricksterv4n1x8 is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-10-2007, 09:26 PM   #4 (permalink)
Contributing Member
 
Join Date: 06-11-07
Posts: 148
iTrader: 0 / 0%
Latest Blog:
None

Capo64 is on the right pathCapo64 is on the right path
It's possible with PHP

I need to know how your page is structured, though.

If you can get your item's ID from the page that you have that would be the best.

Otherwise you're going to have to go through each item page and put a different link on them.

Your contact page is going to have to be in PHP and what you have to do is alter the contact link on each item page.

So for example say your item is an apple your contact link would look like this:

Code:
<a href="contact.php?item=apple">Contact Us</a>
Now when you get to your contact.php code you have a hidden input field with that item. like this:

Code:
<input type="hidden" name="prevpage" value="<?php echo $_GET['item']; ?>" />
I need to see how your page is structured first and then I can do it fairly easily
Capo64 is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-11-2007, 12:09 PM   #5 (permalink)
v7n Mentor
 
Taltos's Avatar
 
Join Date: 11-22-06
Location: Phoenix, AZ
Posts: 1,787
iTrader: 0 / 0%
Latest Blog:
None

Taltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web pro
Send a message via Yahoo to Taltos
Actually, if you page names are reasonably obvious for each product then you can use PHP's superglobal $_SERVER['HTTP_REFERER']. It will give you the url that they came from previous to arriving at your contact page. If your page names are not totally obvious then you might need to do a little string manipulation and translation to make it obvious for whoever is receiving the emails.

Two things to consider with this option:
1. HTTP_REFERER is improperly spelled but that is the way it is spelled for the variable. Real pain in the tail if you spell it correctly because the code doesn't work then!!!
2. You may find that a lot of people's questions do not refer to the page they came from and this could cause more confusion that it is worth. You may be better off just adding a couple of drop down (select) lists to your form that would be required so they have to pick a product. With about 50 products this may only be quick and easy enough for people to use by have one drop-down list of product categories and the second drop-down changes based on the category selected in the first one. Requires a little coding but not too much.

Good luck.
__________________
Experimenting
Taltos is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-13-2007, 08:48 AM   #6 (permalink)
Inactive
 
Join Date: 08-10-07
Posts: 5
iTrader: 0 / 0%
Latest Blog:
None

ricksterv4n1x8 is liked by many
Smile

Wow, this is really great advice. I am going to digest this and test things out a bit before replying. Thanks!
ricksterv4n1x8 is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-13-2007, 10:45 AM   #7 (permalink)
Inactive
 
Join Date: 08-10-07
Posts: 5
iTrader: 0 / 0%
Latest Blog:
None

ricksterv4n1x8 is liked by many
The $_SERVER['HTTP_REFERER'] variable is very cool. The question now is how to incorporate this variable information into my contact form which is currently on an HTML page. To do this I assume I have to change from html to a PHP page. I also assume I need to create a hidden input field in my form where I can add this variable. However, I'm not sure how to do that.

thanks
ricksterv4n1x8 is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-13-2007, 11:22 AM   #8 (permalink)
Contributing Member
 
Join Date: 06-11-07
Posts: 148
iTrader: 0 / 0%
Latest Blog:
None

Capo64 is on the right pathCapo64 is on the right path
Since .php pages interpret HTML code the same way .html pages do, all you have to do is change the extension of .html to .php

Then in your form all you have to do is put this code:
Code:
<input type="hidden" name="referrer" value="<?php echo $_SERVER['HTTP_REFERER']; ?>" />
and you're all set!
Capo64 is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-13-2007, 01:15 PM   #9 (permalink)
v7n Mentor
 
Taltos's Avatar
 
Join Date: 11-22-06
Location: Phoenix, AZ
Posts: 1,787
iTrader: 0 / 0%
Latest Blog:
None

Taltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web pro
Send a message via Yahoo to Taltos
rickster, Capo64 has it for you. One of the beauties of PHP is the ability to jump in and out of PHP in the middle of HTML. You do need to rename your page with the ".php" extension but otherwise leave everything else the same. Capo64 created the little piece of PHP that plugs right in the middle of your HTML and is happy.

Like I mentioned before, you may have to massage that HTTP_REFERER value a bit for it to make sense to the average person. A little string manipulation is all it takes though.

Good Luck.
__________________
Experimenting
Taltos is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-13-2007, 04:52 PM   #10 (permalink)
Inactive
 
Join Date: 08-10-07
Posts: 5
iTrader: 0 / 0%
Latest Blog:
None

ricksterv4n1x8 is liked by many
Wow. Works great!! Many thanks for the great advice!
ricksterv4n1x8 is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with a form on a page orionjade Coding Forum 20 09-30-2007 06:18 AM
online form script - ideas integrating an auto responder? jamesbondcat Coding Forum 14 09-26-2006 03:36 PM
Looking for someone to professionally code and order page form Bluecircle Web Design Lobby 1 06-21-2006 09:49 PM
Auto download document links on a web page charlesmilleriii Web Design Lobby 2 05-27-2005 07:33 AM
Bringing back to your homeland contracts that were previously outsourced offshore webdance Webmaster Revenue 0 10-15-2004 01:45 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 05:05 AM.
© Copyright 2008 V7 Inc