本文整理汇总了PHP中Poll::add_value方法的典型用法代码示例。如果您正苦于以下问题:PHP Poll::add_value方法的具体用法?PHP Poll::add_value怎么用?PHP Poll::add_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poll
的用法示例。
在下文中一共展示了Poll::add_value方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
//
// Add or modify the $VALID_POLLS array to add, modify, or remove polls.
// The key of the $VALID_POLLS associative array represents the poll ID;
// this value must be a string. In addition, it must only use alphanumeric
// characters (A-Z, a-z, and 0-9).
//
// Set the question property of the Poll object to a string representing
// the question to be displayed.
//
// Call add_value() on the Poll object to add a new value. The first
// parameter represents the value ID, which must be a alphanumeric string.
// The second parameter is the string to display to the user for this value.
$VALID_POLLS = array();
// The keys of this associative array are the poll IDs
// First poll definition
$p = new Poll();
$p->question = "Which is your favourite photo?";
// Question displayed to the user
$p->returnToURL = "../index.php?action=contest";
// Specify the URL to return to for this poll; may be relative or absolute
$p->legend = "Contest Poll";
// Form legend; leave empty for none
$p->control_type = $CONTROL_RADIOBUTTONS;
// Control type; $CONTROL_RADIOBUTTONS or $CONTROL_COMBOBOX
$p->add_value("1", "Orange");
// Poll value ID and a display string
$p->add_value("2", "Green");
$p->add_value("3", "Blue");
$p->add_value("4", "Yellow");
$VALID_POLLS["1"] = $p;
// "1" is the poll ID
示例2: array
// Call add_value() on the Poll object to add a new value. The first
// parameter represents the value ID, which must be a alphanumeric string.
// The second parameter is the string to display to the user for this value.
$VALID_POLLS = array();
// The keys of this associative array are the poll IDs
// First poll definition
$p = new Poll();
$p->question = "Kirmizi Kusak Mod Adayiniz Kim?";
// Question displayed to the user
$p->returnToURL = "../example.php";
// Specify the URL to return to for this poll; may be relative or absolute
$p->legend = "Mod adayim";
// Form legend; leave empty for none
$p->control_type = $CONTROL_RADIOBUTTONS;
// Control type; $CONTROL_RADIOBUTTONS or $CONTROL_COMBOBOX
$p->add_value("1", "psycho");
// Poll value ID and a display string
$p->add_value("2", "pajir");
$p->add_value("3", "safsata");
$p->add_value("4", "mourn");
$p->add_value("5", "barbarossache");
$p->add_value("6", "cooler");
$p->add_value("7", "clown");
$p->add_value("8", "komiksey");
$p->add_value("9", "aphrodiletto");
$p->add_value("10", "smileatlife");
$p->add_value("11", "nickness");
$VALID_POLLS["1"] = $p;
// "1" is the poll ID
// Second poll definition
/*
示例3: Poll
// Question displayed to the user
$p->returnToURL = "../example4.php";
// Specify the URL to return to for this poll; may be relative or absolute
$p->legend = "Pregunta 11";
// Form legend; leave empty for none
$p->control_type = $CONTROL_COMBOBOX;
// Control type; $CONTROL_RADIOBUTTONS or $CONTROL_COMBOBOX
$p->add_value("1", "a. Diariamente");
// You may include the optional URL parameter to create a link
$p->add_value("2", "b. Dos o tres veces por semana");
$p->add_value("3", "c. Una vez por semana");
$p->add_value("4", "d. Cada quince días");
$p->add_value("5", "e. Una vez por mes");
$p->add_value("6", "f. Cada seis meses");
$p->add_value("7", "g. Una vez por año");
$VALID_POLLS["11"] = $p;
$p = new Poll();
$p->question = "Califique la calidad de los servicios prestados por la Biblioteca Central a través de las bases de datos y bibliotecas digitales";
// Question displayed to the user
$p->returnToURL = "../example4.php";
// Specify the URL to return to for this poll; may be relative or absolute
$p->legend = "Pregunta 12";
// Form legend; leave empty for none
$p->control_type = $CONTROL_RADIOBUTTONS;
// Control type; $CONTROL_RADIOBUTTONS or $CONTROL_COMBOBOX
$p->add_value("1", "a. Excelente");
// You may include the optional URL parameter to create a link
$p->add_value("2", "b. Buena");
$p->add_value("3", "c. Regular");
$p->add_value("4", "d. Deficiente");
$VALID_POLLS["12"] = $p;