SOLVED Redirect based on DB Field Value

gabedaly 15 Mar, 2012
Hello All,
I am trying to figure out what to put in the Where box of DB Record Loader (on load event) to redirect a user to another form based on the value of a field name.
For example;
If a user logs in and their value for field "jobdescription" is PAYT, I want to automatically redirect them to one form.
Then if another user logs in and their value for field "jobdescription" is Standard Service, I want them to go to a different form.
Any suggestion please please.

Thanks once again,
Gabe
Max_admin 15 Mar, 2012
Hi Gabe,

Assuming that you could load the data from the database using the logged in user ID, then the data should be available under your form->data array(you can add a debugger to list it), which you can use into a "Custom code" action with some PHP to redirect the user to where you need.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gabedaly 15 Mar, 2012
Thanks Max,
I was able to find a post that helped me figure out what to put in the custom code box placed inside the DB Record Loader on record found event. Here it is:
<?php
$mainframe =& JFactory::getApplication();

if($form->data['your_field'] == 'some field value')
{
$mainframe->redirect('http://www.something.com');
}
else if($form->data['your_field'] == 'some field value')
{
$mainframe->redirect('http://www.something.com');

}
?>

Hope this helps someone else :wink:
This topic is locked and no more replies can be posted.