English 中文(简体)
Joomla! 登记目录 表格,打电话给行
原标题:Joomla! Populate List Box on Registration Form by calling DB

事先感谢您的帮助......

我已修改了登记案卷和其他必要档案,以便在我的登记表中添加其他表格。 这些田地目前都是文本箱,我想为像国家这样的物品建立名单箱。 我不想在选择和价值上打上型号,而是从数据库的一个桌上抽取。

在我的注册档案中,该法典是:

<field name="statelist2" type="list" 
default=""
label="COM_USERS_REGISTER_STATE_LABEL"
description="COM_USERS_REGISTER_STATE_DESC"
message="COM_USERS_REGISTER_STATE_MESSAGE">
<option value="CT">CT</option>
<option value="MA">MA</option>
</field>

我在注册的xml档案中,该守则确实是NOT的工作,我试图取消向亚洲开发银行发出的要求,即只把这个网页装上一些实验室:

<field name="statelist" 
type="list"
default=""
label="COM_USERS_REGISTER_STATE_LABEL"
description="COM_USERS_REGISTER_STATE_DESC"
message="COM_USERS_REGISTER_STATE_MESSAGE">
<?php
$x = "CT";
$z = "NY";
echo "<option value= " . $x. " >" . $x . "</option>"; 
echo "<option value= " . $z. " >" . $z . "</option>"; 
?>
</field>

My question(s): 1) Where do I have to put the code (in what file) in order to either create the list box or populate it with potential values?

2) 为了利用现有的Joomla! 登记。 php将装货单的一些功能归档,并获取数据——我能否在那里用密码在登记表格中填满物品? 我是这样想的,但并不肯定。

<?php 
    //init Joomla Framework 
    define(  _JEXEC , 1 ); 
    define(  DS , DIRECTORY_SEPARATOR ); 
    define(  JPATH_BASE , realpath(dirname(__FILE__).DS. ..  )); 


    require_once ( JPATH_BASE .DS. includes .DS. defines.php  ); 
    require_once ( JPATH_BASE .DS. includes .DS. framework.php  ); 

    $mainframe = JFactory::getApplication( site ); 

    //DBQuery 
    $database =& JFactory::getDBO(); 
    $query = "SELECT * FROM #__tbl_State;"; 

$database->setQuery($query); 
    //$result = $database->query();
$items = ($items = $db->loadObjectList())?$items:array(); 
    //print_r($result); 
?> 
问题回答
<field
        name="STUDENT_COURSE"
        type="sql"
        multiple="false"
        size="1"
        label="Interested In Course"
        description="COM_HELLOWORLD_FORM_DESC_UPDHELLOWORLD_GREETING"
        query="select Course_Id, Course_Name from student_course"
        key_field="Course_Id"
        value_field="Course_Name"
        default="0"
required="true"
        >
     <option value="">Please Select Course</option>
</field>

那么,我像你一样,期待你为之作出辛勤的工作。

Unless I am missing something, and I often do, you could simply use the right tool for the job ;) http://docs.joomla.org/SQL_form_field_type

Failing that you might find another field type that will work for you. http://docs.joomla.org/Standard_form_field_types





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签