# contact-forms/1.9.2/classes/Element/Select.php

Contact Forms by Cimatti, version 1.9.2. 28 lines.

- Page: https://pluginprobe.com/plugins/contact-forms/1.9.2/code/classes/Element/Select.php
- Raw: https://pluginprobe.com/plugins/contact-forms/1.9.2/raw/classes/Element/Select.php
- Modified: 2023-03-14T12:04:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/contact-forms/1.9.2/code/classes/Element/Select.php#L10-L20`.

```php
<?php
class AccuaForm_Element_Select extends AccuaForm_OptionElement {
	protected $attributes = array("class" => "pfbc-select");

	public function render() { 
		if(isset($this->attributes["value"])) {
			if(!is_array($this->attributes["value"]))
				$this->attributes["value"] = array($this->attributes["value"]);
		}
		else
			$this->attributes["value"] = array();

		if(!empty($this->attributes["multiple"]) && substr($this->attributes["name"], -2) != "[]")
			$this->attributes["name"] .= "[]";

		echo '<select', $this->getAttributes(array("value", "selected")), '>';
		foreach($this->options as $value => $text) {
			$value = $this->getOptionValue($value);
			echo '<option value="', $this->filter($value), '"';
			$selected = false;
			if(in_array($value, $this->attributes["value"]))
				echo ' selected="selected"';
			echo '>', $text, '</option>';
		}	
		echo '</select>';
	}
}

```
