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, 3 months 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, 3 months 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, 3 months 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, 3 months 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, 3 months 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, 3 months 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.37 seconds

Facebook Discount - 40% Off!

Fans of our Facebook page here are entitled to get a 1-year-subscription for the price of a 6-months!

Steps to take:

  • Become a fan on Facebook (Like) here
  • Purchase a 6-months-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of your like and we'll upgrade to the 1-year-subscription

Joomla!® Forms Discount - 40% Off!

Already purchased a forms extension from a different vendor but your requirements changed and now you need a forms extension that is capable of more than just the standards? We help you to keep the costs for a change under control: Get a 40% discount on our professional membership plan! -- meaning timely unlimited access to all current and future commercial extensions, breezingforms themes & apps and Joomla!® templates at crosstec.de, including 1 year of support -- without any website limitations -- Just prove that you previously purchased another forms extension for Joomla!® from a different vendor and you are qualified.

Steps to take:

  • Purchase a 1-year-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of the purchase for the other form vendor and we'll upgrade to the professional-subscription

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany

Imprint