Posting to a dynamic email address from a previous page

edgarlomax 23 Jul, 2009
I'm using the TPJobs component and ChronoForms. Each job application is going to go to a different, predefined email address. They will all be on the same domain, just unique usernames for identification purposes.

I've managed to create a URL which picks up the email address but I'm stuck on actually getting the form to send the results to this address.

the previous page code is:

index.php?option=com_chronocontact&chronoformname=sendcv&recipients=<?php echo $job->currency_salary; ?>

(I'm actually using an unused field to store the email address so please ignore the field name...)

the generated url is:

index.php?option=com_chronocontact&chronoformname=sendcv&recipients=123456@domain.com

How can I then pass that email address to ChronoForms so the form contents can be emailed correctly?

Thanks in advance.
GreyHead 23 Jul, 2009
Hi Edgarlomax,

See this post from earlier today for the basic methodology. Plus to get the variable from the URL you'll need
$recipient = JRequest::getString('recipient', '', 'get);

Bob
edgarlomax 23 Jul, 2009
Thanks Bob,

I think I've found a way, viz:

Turn on SEF URLs to produce a url like this:

<!-- w --><a class="postlink" href="http://www.domain.com/sendcv?123456@foobar.com">www.domain.com/sendcv?123456@foobar.com</a><!-- w -->

Use this code in the form to get the query string:

<?php
$queryString = $_SERVER['QUERY_STRING'];
?>

Then enter it into a hidden field to act as a to address:

It's a bit hacky 😶 , but works for the moment.

I'll take a look at your method now. I saw it earlier but didn't really understand it.

Thanks for answering.
GreyHead 23 Jul, 2009
Hi EdgarLomax,

Mine *should* do the same as yours but a little more elegantly (and without the need for SEF URLs).

Variables from the submitting URL are available in the $_GET array and Joomla makes a filtered version of the variables availalbe through the code I posted.

Bob
edgarlomax 23 Jul, 2009
OK, tried my way and it worked to a point.

Tried your way and I can't get it to work.

Can you explain it to a slow but steady learner like me?

Thanks,

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