I have built 2 queries
$id = JFactory::getApplication()->input->getIn('vid');
$db = JFactory::getDbo();
$db->setQuery("SELECT `email` FROM `#__usedcar_variants` WHERE `id`='$id' LIMIT 1");
$_POST['form']['Email'] = $db->loadResult();
$id = JFactory::getApplication()->input->getIn('vid');
$db = JFactory::getDbo();
$db->setQuery("SELECT `mobile` FROM `#__usedcar_variants` WHERE `id`='$id' LIMIT 1");
$_POST['form']['Contact'] = $db->loadResult();
However - it seems not the best way for optimization, as ideally
- both the email and mobile can be collected in a single query,
- store them in an array,
- then assign each array value to the correct field
Can someone help pls on it