Forums

Form on multiple pages, original page tracking?

Talaysen 12 Apr, 2010
Hello,

I recently added ChronoForms to my website, I'm absolutely happy with it, I think it's better than all of the other form systems that are available at this time.

The website I'm building use articles to display products and product info.
I've created one form at the bottom of the page that will be used for customers requesting additional information or quotes.

I want to have this form at the bottom of each article (each product),
I don't want to have to write a new form for every single product page, so I was
hoping there would be a way to log which page the user submitted the form from.

(I want the form to submit the article link via a hiddden field).

Anyone know if this would be possible?
Talaysen 12 Apr, 2010
I found a solution for this,
You can add the following bit of PHP code to your form:


<?php
function curPageURL() {
 $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"];
 }
 return $pageURL;
}
?>


And call the current page URL using:


<?php
  echo curPageURL();
?>


To add it to the form, you could paste it in a hidden field:

<input value="<? echo curPageURL(); ?>" id="hidden_12" name="pageurl" type="hidden" />


To have it appear in your e-mail, simply tag it in with {pageurl} at your appropriate location.
GreyHead 13 Apr, 2010
Hi Talaysen,

It depends a bit what you actually want. Joomla has a URI object that will let you access most parts of the current URI. Your code would become:
<?php
$uri =& JFactory::getURI();
?>
. . .
<input value="<?=$uri?>" id="pageurl" name="pageurl" type="hidden" />

Bob
Talaysen 07 Jul, 2010
Recently I switched to SEO links (using sh404sef),
the link that is grabbed from my original snippet of code is invalid:
"/index.php?option=com_content&Itemid=64&catid=34&id=3〈=en&view=article"

Is there a way to grab the SEO link instead of the original link?
This topic is locked and no more replies can be posted.