Welcome, Guest

Capture the page that the form resides
(1 viewing) (1) Guest

TOPIC: Capture the page that the form resides

Capture the page that the form resides 2 years ago #11511

I need to make a form, which is included in over 100 pages, send in the email, and store in the data, the url of the page from which it was submitted

Can anyone tell me how to do this?

Regards

Steven
  • StevenD
  • OFFLINE
  • Junior Boarder
  • Posts: 26
  • Karma: 0

Re: Capture the page that the form resides 2 years ago #11521

Hi,

you just need to use some php and add it to the "before form" piece and fill a hidden field's value with the url.

Like this:

$this->execPieceByName('ff_InitLib');
ff_setValue('page', JURI::current()); // 'page' is the name of the hidden field
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
===============================================

Re:Capture the page that the form resides 2 years ago #11525

Hi

Thanks for the help, it nearly worked, but it didnt catch the whole url

the email and data contain just ..

page: www.domain.com/index.php

I need to catch the whole url, the form is in the desription of a virtuemart store, so I need to catch the product page which the questions on the form were filled and sent from, so that the correct product can be identified for answering the request.

I need to capture the extra to that..

index.php?page=shop.product_details&flypage=flypage_images.tpl&product_id=81&category_id=7&option=com_virtuemart&Itemid=68


Thanks

Steven
  • StevenD
  • OFFLINE
  • Junior Boarder
  • Posts: 26
  • Karma: 0

Re:Capture the page that the form resides 2 years ago #11526

hmmm, I could swear I read JURI::current() would return the complete url, looks like I was wrong, sorry.
But you can try this instead:

$pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }


$this->execPieceByName('ff_InitLib');
ff_setValue('page', $pageURL); // 'page' is the name of the hidden field
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
===============================================

Re:Capture the page that the form resides 2 years ago #11527

Hi Thanks

I tried the above and it seemed ok, but I have altered it slightly and used the following, and it all seems to work ok now


 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL = "https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL = "http://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }


$this->execPieceByName('ff_InitLib');
ff_setValue('page', $pageURL); // 'page' is the name of the hidden field



Thanks for the help

Steven
  • StevenD
  • OFFLINE
  • Junior Boarder
  • Posts: 26
  • Karma: 0

Re:Capture the page that the form resides 2 years ago #11528

ok, great but just for the logs: people using ssl should use the first code snippet.

Regards,
Markus
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
===============================================
Moderators: TheMuffinMan, ForumSupport
Time to create page: 0.42 seconds

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany