Forums

how can I insert the url or the name of the content

incirus 11 Feb, 2009
I want to create forms for my clients to check the availability of the products.
I dont want to create a drop down where customers pick the name of the product.
I want the form to pull out the name or the url of the page automatically.
Is there any way to do this.
thanks
GreyHead 11 Feb, 2009
Hi incirus,

Yes, you can do it - but where is the product name / id coming from exactly??

Bob
incirus 11 Feb, 2009
these are just the regular contents.
the name of the content is the name of the product.
getting the url would do the trick for me.
all I want to do is just get the url where the form is filled.
GreyHead 11 Feb, 2009
Hi incirus,

In the Form HTML try this
<?php
$uri = JFactory::getURI();
echo "uri: ".print_r($uri, true)."<br /><br />";
?>
If I remember correctly this gives you a uri Object and the parts you need are probably in $uri->query

Bob
incirus 11 Feb, 2009
thanks for the reponse.
this will probably work but I think I need change the code or mix it with something else.
this is what I get from the code.

uri: JURI Object ( [_uri] => http://example.com/path/index.php?option=com_chronocontact&chronoformname=formname [_scheme] => http [_host] => example.com [_port] => [_user] => [_pass] => [_path] => /path/index.php [_query] => option=com_chronocontact&chronoformname=formname [_fragment] => [_vars] => Array ( [option] => com_chronocontact [chronoformname] => formname ) [_errors] => Array ( ) ) 


I know it looks very messy but this can work for me.
but the problem is, the outcome is also displayed with the form.
I want to get the outcome of url via email without displaying to the customers.
thanks
incirus 11 Feb, 2009
I managed it.
i put that code as hidden value from the html code and it worked for me.
it doesnt look so pretty but I got what I wanted.
thank you very much
GreyHead 11 Feb, 2009
Hi incirus,

Sorry, I was just foo to dinner. I suggested that just to show you what was there. Then you can pull out just the part that you need.
<?php
$uri = JFactory::getURI();
$uri_full = $uri->_uri;
?>
. . .
<input type='hidden' name='uri' value='<?php echo $uri_full; ?>' />

Bob
This topic is locked and no more replies can be posted.