Hi again...
I'm working on another module now where I need to upload a file, update some info on a table, refering to the user that uploaded it.
I've being trying but no success until now. Here is my codes:
On submit code before:
Auto generated:
I need help to make it work, please!
I'm working on another module now where I need to upload a file, update some info on a table, refering to the user that uploaded it.
I've being trying but no success until now. Here is my codes:
<?php
// Get user-information from Joomla
$user = &JFactory::getUser();
?>
<div class="form_item">
<h1>Envio do Comprovante</h1>
</div>
<div class="form_item">
<span class="cf_text">Envie aqui o comprovante de pagamento.</span>
</div>
<div class="form_item">
<label>Enviar Boleto</label><br />
<input class="cf_fileinput cf_inputbox required" title="Você deve selecionar um arquivo." size="20" id="file_0" name="file_0" type="file" />
<a class="tooltiplink" onclick="return false;"><img height="15" border="0" width="15" class="tooltipimg" alt="" src="images/site/tooltip.png"/></a>
<div class="tooltipdiv">Boleto :: Envie o arquivo do boleto.</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<input value="Enviar" name="button_15" type="submit" /><input type="reset" name="reset" value="Reset"/>
<div class="cfclear"> </div>
</div>
On submit code before:
<?php
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
$query = "
SELECT `cf_id`
FROM `#__chronoforms_usuarios`
WHERE `cf_user_id` = '".$user->id."' ;
";
$db->setQuery($query);
$cf_id = $db->loadResult();
JRequest::setVar('cf_id', $cf_id);
?>
Auto generated:
<?php
$MyForm =& CFChronoForm::getInstance("comprovante");
if($MyForm->formparams("dbconnection") == "Yes"){
$user = JFactory::getUser();
$row =& JTable::getInstance("chronoforms_usuarios", "Table");
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16).md5(uniqid(mt_rand(), true));
JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );
if (!$row->bind( $post )) {
JError::raiseWarning(100, $row->getError());
}
if (!$row->store()) {
JError::raiseWarning(100, $row->getError());
}
$MyForm->tablerow["jouefs10_chronoforms_usuarios"] = $row;
}
?>
I need help to make it work, please!