1. Important notice about Cloudbleed - if your site uses the Cloudflare CDN, and you intend to follow the Joomla security team's advice to change your site "secret", you MUST READ THIS NOTICE.
  2. Fabrik 3.6 Released Remember to backup and test your backup before proceeding with this update. Please report any problems you might experience with this new version here on the forum. You are safe to upgrade to Joomla! 3.7 and PHP 7.x with this version of Fabrik. View the blog for more details on this release.

How to retrieve values from another form and use as the default valuel for a field

Discussion in 'Subscriber Support' started by steemer473, Dec 19, 2010.

  1. steemer473

    steemer473 Member

    Level: Community
    I am trying to retrieve values from Form B in order to prepopulate Form A. I am not a programmer so please bear with me. Below is the php code I am using.

    $db = JFactory::getDBO();
    $user = JFactory::getUser();
    $userid = $user->get('id');
    $db->setQuery("
    SELECT jos_Agents.agent_type
    FROM `jos_Agents` WHERE jos_RFC.user_id =$userid");
    $results = $db->loadResult();
    return $results;

    This code is what I am using to retrieve the value of the agent_type field. When I load the form, the field is blank. I'm not seeing what is wrong with this expression. Can you identify why this isn't working
     
  2. rob

    rob Administrator Staff Member

    Level: Community
    looks correct to me.
    After your $db->setQUeyr();

    add

    echo $db->getQuery();exit;

    to see what the query is that is being run.
    Then paste that into phpMyAdmin to see whether an error is reported or if the data is correctly returned.
     

Share This Page