Forum Moderators: coopster

Message Too Old, No Replies

Include referencing page in form

1 form - various reference pages

         

tbear

9:46 pm on Oct 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Not sure if php is the ideal solution, but here goes...

Basically, what I want to do is link to a form from various, static, html pages and include the referencing page name somewhere in the form result.

I.E.
Pages abc.html, def.html and ghi.html all have a 'further information' link, which leads to a form. How could I include the reference abc, def, or ghi, in the form result, so I know what they want more information about? It wouldn't matter if the .html is tagged on the end of the reference.

I'm afraid that until I figure out how to get the @%=^* xampp thingy working on my 'puter, I won't start learning real php :(

Please help me with a simple solution. I'd prefer not to use javascript, but a simple html or php solution would be ideal.

StupidScript

10:41 pm on Oct 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just include this within the body of your form:

<input type="hidden" name="referer" value="<?=$_SERVER["HTTP_REFERER"]?>" />

That will grab the referring page and include it as the "referer" form element when it is submitted.

tbear

10:44 pm on Oct 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanx for that SS, got me out of a fix......

tbear

5:48 pm on Oct 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Bit of a problem with that code......

When I view the page, the last 2 symbols, /> appear on the page.
That can't be right, I certainly can't live with it :(

tbear

6:22 pm on Oct 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Any other suggestions?
Please.....:)

jatar_k

6:33 pm on Oct 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



StupidScript's tag shouldn't do that

can you post the exact line you are using?

tbear

6:49 pm on Oct 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have this:
<input type="hidden" name="referer" value="<?=$_SERVER["HTTP_REFERER"]?>" />
without the linebreak.
I tried it on my 'puter, not online and the quote mark, slash and chevron appear on the page.
The code is inserted within the first section of form code, along with form method and the other input types....

jatar_k

6:51 pm on Oct 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



and what does view source show you?

the tag is correct, you could try a variation though

<input type="hidden" name="referer" value="<?php echo $_SERVER['HTTP_REFERER'];?>">

tbear

7:06 pm on Oct 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



View source shows it exactly the same.

I'll try the other online now....

tbear

7:18 pm on Oct 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Seems to work a dream, thank you both very much for your help!

jatar_k

7:19 pm on Oct 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



difference was the short tags

<?=

is short for

<?php echo

tbear

7:25 pm on Oct 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Ah, ha, haaa...
I must get that Apache server working on my 'puter, so I can start learning that stuff. Might just have to pay someone locally to do it, when I can afford it :(

StupidScript

11:00 pm on Oct 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Good catch, jatar_k! I'll post both the short tag and the long tag examples from now on. Thanks! Glad it's working, tbear.

coopster

5:29 pm on Oct 10, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




I must get that Apache server working on my 'puter

It's pretty easy and once setup you will wonder how you ever got along with out it! There are a couple of threads in the PHP Forum Library describing how to get PHP setup with your Apache server.

neonerz

12:45 am on Oct 11, 2005 (gmt 0)

10+ Year Member



Xampp is great and real easy to install....

Linux install -

extract the archive to /opt

"tar xvfz xampp-linux-1.4.16.tar.gz -C /opt"

then type this to start it

"/opt/lampp/lampp start"

and don't forget to run the security script

"/opt/lampp/lampp security"

link to DOCs [apachefriends.org...]