Php 如何在vtiger crm中添加状态名称下拉框
我有一个表单,我必须添加一个带有下拉列表的状态名称字段,这样用户可以从选择框中选择他们想要的状态名称Php 如何在vtiger crm中添加状态名称下拉框,php,mysql,vtiger,Php,Mysql,Vtiger,我有一个表单,我必须添加一个带有下拉列表的状态名称字段,这样用户可以从选择框中选择他们想要的状态名称 我该怎么做呢?假设你有一个像mysql这样的数据库 创建表状态(状态id、状态名称、状态缩写) 从状态表获取状态(编写函数获取状态) 使用php脚本在选择框的选项中迭代 例如: <select name="state"> <?php *// At this point you should have a reco
我该怎么做呢?假设你有一个像mysql这样的数据库
- 创建表状态(状态id、状态名称、状态缩写)
- 从状态表获取状态(编写函数获取状态)
- 使用php脚本在选择框的选项中迭代
例如:
<select name="state"> <?php *// At this point you should have a recordset $rsstate which fetches all the records from the state table* while($rowState = mysql_fetch_array($rsState)){?> <option value=<?php echo $rowState["state_abbr"]?>><?php echo $rowState["state_name"]; ?></option> <?php }?> </select>
<select name="state"> <?php // At this point you should have a recordset $rsstate which fetches all the records from the state table while($rowState = mysql_fetch_array($rsState)) { ?> <option value=<?php echo $rowState["state_abbr"] ?>><?php echo $rowState["state_name"]; ?></option> <?php } ?> </select>
- 创建一个表
(state
,state\u id
,state\u name
)state\u abbr
- 从
表中获取状态(编写函数获取状态)state
- 使用php脚本在选择框的选项中迭代,例如:
<select name="state"> <?php *// At this point you should have a recordset $rsstate which fetches all the records from the state table* while($rowState = mysql_fetch_array($rsState)){?> <option value=<?php echo $rowState["state_abbr"]?>><?php echo $rowState["state_name"]; ?></option> <?php }?> </select>
<select name="state"> <?php // At this point you should have a recordset $rsstate which fetches all the records from the state table while($rowState = mysql_fetch_array($rsState)) { ?> <option value=<?php echo $rowState["state_abbr"] ?>><?php echo $rowState["state_name"]; ?></option> <?php } ?> </select>
<?php
$Vtiger_Utils_Log = true;
include_once('vtlib/Vtiger/Menu.php');
include_once('vtlib/Vtiger/Module.php');
$module = Vtiger_Module::getInstance('Accounts');
$infoBlock = Vtiger_Block::getInstance('LBL_ACCOUNT_INFORMATION', $module);
$stateField = Vtiger_Field::getInstance('state', $module);
if (!$stateField) {
$stateField = new Vtiger_Field();
$stateField->name = 'state';
$stateField->label = 'State';
$stateField->columntype = 'VARCHAR(100)';
$stateField->uitype = 16;
$stateField->typeofdata = 'V~O';
$infoBlock->addField($stateField);
$stateField->setPicklistValues(array('Kerala', 'Karnataka', 'Maharashtra', 'Manipur'));
}
谢谢您的回复。。。。。。事实上,我已经在核心PHP中完成了这类工作,我知道如何准确地完成,但在Vtiger CRM中,我们必须更改哪些文件,这是一个非常复杂的问题,因此它在tpl文件中正确地出现。这就是我的问题。。