i have some problems with something i want to code.
I have a list of documents, with a link buy for some of them.
I would like that when a visitor click on buy, he arrive on a form with a few fields (name, email, the id of the document -hidden- and some more).
We done , the result should be stored on the database.
I look at form builder, with a "store to database" action. but, as i cant see how to manage the sql query to add several field as the date, or to execute some code to verify that the id_document is valid, or something like that, i try something else.
I add a "execute a user tag" in my form instead of the "store in db", but it doesn't seem to work.
I try $_GET or $params of the name of the field i add in form builder or the name the is actually displayed in the html source : something like : m5fbrp__25
How can i debug some variable in the user tag? When there is an error on a field of the form , i lost the variable id_document in the url. How can i keep it?
Is there a simple way to do what i want to do?
Another thing, i have some difficulties using smarty->assign :
i have a user tag :
Code: Select all
global $gCms;
$hm =& $gCms->GetHierarchyManager();
$db = &$gCms->db;
if(isset($_GET['document']) && is_numeric($_GET['document'])){
$reqt = "SELECT * FROM cms_module_uploads as f WHERE f.upload_id=".$_GET['document']." LIMIT 1";
$rest = $db->Execute($reqt);
$ligne = $rest->FetchRow();
$gCms->smarty->assign('document', $ligne['upload_name']);
$gCms->smarty->assign('montant',$ligne['tarif']);
}else{
$gCms->smarty->assign('document', 'Nothing selected');
$gCms->smarty->assign('montant','');
}
if i use {document} or {montant} in the page after calling the user tag, i have no smarty error, so it seems they are defined but they are empty, nothing is displayed.
if i do print_r($ligne) i have values, so the query is ok. Any idea?
Thanx for your help, i found cmsms really great (tahnx for the team), but i still have some difficulties when it's about to code my own modules/user tag.