MyFORM class v0.3


SUBMITTED BY: Guest

DATE: Dec. 5, 2013, 7:19 a.m.

FORMAT: PHP

SIZE: 35.9 kB

HITS: 934

  1. <?php
  2. /////////////////////////////////////////////////////////////////////////////////
  3. // -----------------------------------------------------------------------------
  4. // MyFORM class v0.3
  5. //
  6. // Created by LL
  7. // Copyright by SP
  8. // -----------------------------------------------------------------------------
  9. //
  10. //
  11. //
  12. //
  13. //
  14. // -----------------------------------------------------------------------------
  15. /////////////////////////////////////////////////////////////////////////////////
  16. // -----------------------------------------------------------------------------
  17. // Command Function
  18. // -----------------------------------------------------------------------------
  19. // __construct Initial a form
  20. // -----------------------------------------------------------------------------
  21. /////////////////////////////////////////////////////////////////////////////////
  22. class MyFORM
  23. {
  24. private $action; // target for Form data
  25. private $method; // POST (Standart) or GET = 1
  26. private $form_n; //
  27. private $FORM = array(); //
  28. private $FORM_INDEX = 0; //
  29. private $only = 0; //
  30. private $c_head = 0; //
  31. private $c_feed = 0; //
  32. private $c_fs_head = 0; //
  33. private $c_fs_feed = 0; //
  34. private $c_radio = 0; //
  35. private $c_select_head = 0; //
  36. private $c_select_multi = 0; //
  37. private $c_select_group = 0; //
  38. private $c_select_selected = 0; //
  39. /////////////////////////////////////////////////////////////////////////////////
  40. // -----------------------------------------------------------------------------
  41. // NAME:
  42. // DESCRIPTION:
  43. // ARGUMENTS:
  44. // USES GLOBAL:
  45. // MODIFIES GL:
  46. // RETURNS:
  47. // DATE:
  48. // -----------------------------------------------------------------------------
  49. /////////////////////////////////////////////////////////////////////////////////
  50. public function __construct( $Myform_n = NULL, $MYaction = NULL, $MYmethod = NULL )
  51. {
  52. if( !isset( $MYaction ) ) $this-> only = 1;
  53. $this-> action = $MYaction;
  54. $this-> form_n = $Myform_n;
  55. if( $MYmethod == 1 )
  56. {
  57. $this-> method = "GET";
  58. }
  59. else
  60. {
  61. $this-> method = "POST";
  62. }
  63. }
  64. /////////////////////////////////////////////////////////////////////////////////
  65. // -----------------------------------------------------------------------------
  66. // NAME:
  67. // DESCRIPTION:
  68. // ARGUMENTS:
  69. // USES GLOBAL:
  70. // MODIFIES GL:
  71. // RETURNS:
  72. // DATE:
  73. // -----------------------------------------------------------------------------
  74. /////////////////////////////////////////////////////////////////////////////////
  75. public function create_Form()
  76. {
  77. if( $this-> c_feed == 1 )
  78. {
  79. for( $i = 0; $i <= $this-> FORM_INDEX; $i++ )
  80. {
  81. echo $this-> FORM[$i];
  82. }
  83. }else echo "ERROR - Don't FEED define\n";
  84. }
  85. /////////////////////////////////////////////////////////////////////////////////
  86. // -----------------------------------------------------------------------------
  87. // NAME:
  88. // DESCRIPTION:
  89. // ARGUMENTS:
  90. // USES GLOBAL:
  91. // MODIFIES GL:
  92. // RETURNS:
  93. // DATE:
  94. // -----------------------------------------------------------------------------
  95. /////////////////////////////////////////////////////////////////////////////////
  96. public function getForm()
  97. {
  98. $varForm = NULL;
  99. if( $this-> c_feed == 1 )
  100. {
  101. for( $i = 0; $i <= $this-> FORM_INDEX; $i++ )
  102. {
  103. $varForm = varForm . FORM[$i];
  104. }
  105. return $varForm;
  106. }else echo "ERROR - Don't FEED define\n";
  107. }
  108. /////////////////////////////////////////////////////////////////////////////////
  109. // -----------------------------------------------------------------------------
  110. // NAME:
  111. // DESCRIPTION:
  112. // ARGUMENTS:
  113. // USES GLOBAL:
  114. // MODIFIES GL:
  115. // RETURNS:
  116. // DATE:
  117. // -----------------------------------------------------------------------------
  118. /////////////////////////////////////////////////////////////////////////////////
  119. public function fHead( $id = "" )
  120. {
  121. $stuff = '<form ';
  122. if( strlen( $id ) > 0 )
  123. {
  124. $stuff = $stuff . 'id="' . $id . '" ';
  125. }
  126. $stuff = $stuff . 'action="' . $this->action . '" method="'. $this->method . '">'."\n";
  127. if( $this-> only == 1 )
  128. {
  129. echo $stuff;
  130. }
  131. else
  132. {
  133. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  134. $this-> FORM_INDEX++;
  135. $this-> c_head = 1;
  136. }
  137. }
  138. /////////////////////////////////////////////////////////////////////////////////
  139. // -----------------------------------------------------------------------------
  140. // NAME:
  141. // DESCRIPTION:
  142. // ARGUMENTS:
  143. // USES GLOBAL:
  144. // MODIFIES GL:
  145. // RETURNS:
  146. // DATE:
  147. // -----------------------------------------------------------------------------
  148. /////////////////////////////////////////////////////////////////////////////////
  149. public function fFeed()
  150. {
  151. $stuff = '</form>'."\n";
  152. if( $this-> only == 1 )
  153. {
  154. echo $stuff;
  155. }
  156. elseif( $this-> c_head == 1 )
  157. {
  158. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  159. $this-> FORM_INDEX++;
  160. $this-> c_feed = 1;
  161. }else echo "ERROR - Don't HEAD define\n";
  162. }
  163. /////////////////////////////////////////////////////////////////////////////////
  164. // -----------------------------------------------------------------------------
  165. // NAME:
  166. // DESCRIPTION:
  167. // ARGUMENTS:
  168. // USES GLOBAL:
  169. // MODIFIES GL:
  170. // RETURNS:
  171. // DATE:
  172. // -----------------------------------------------------------------------------
  173. /////////////////////////////////////////////////////////////////////////////////
  174. public function fs_head( $id = "" )
  175. {
  176. $stuff = '<fieldset';
  177. if( strlen( $id ) > 0 )
  178. {
  179. $stuff = $stuff . ' id="' . $id . '" ';
  180. }
  181. $stuff = $stuff . '>'."\n";
  182. if( $this-> only == 1 )
  183. {
  184. echo $stuff;
  185. }
  186. else
  187. {
  188. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  189. $this-> FORM_INDEX++;
  190. $this-> c_fs_head = 1;
  191. }
  192. }
  193. /////////////////////////////////////////////////////////////////////////////////
  194. // -----------------------------------------------------------------------------
  195. // NAME:
  196. // DESCRIPTION:
  197. // ARGUMENTS:
  198. // USES GLOBAL:
  199. // MODIFIES GL:
  200. // RETURNS:
  201. // DATE:
  202. // -----------------------------------------------------------------------------
  203. /////////////////////////////////////////////////////////////////////////////////
  204. public function fs_legend( $value, $id = "" )
  205. {
  206. $stuff = '<legend';
  207. if( strlen( $id ) > 0 )
  208. {
  209. $stuff = $stuff . ' id="' . $id . '" ';
  210. }
  211. $stuff = $stuff . '>' . $value . '</legend>'."\n";
  212. if( $this-> only == 1 )
  213. {
  214. echo $stuff;
  215. }
  216. elseif( $this-> c_fs_head == 1 )
  217. {
  218. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  219. $this-> FORM_INDEX++;
  220. }else echo "ERROR - Don't Fieldset HEAD define\n";
  221. }
  222. /////////////////////////////////////////////////////////////////////////////////
  223. // -----------------------------------------------------------------------------
  224. // NAME:
  225. // DESCRIPTION:
  226. // ARGUMENTS:
  227. // USES GLOBAL:
  228. // MODIFIES GL:
  229. // RETURNS:
  230. // DATE:
  231. // -----------------------------------------------------------------------------
  232. /////////////////////////////////////////////////////////////////////////////////
  233. public function fs_label( $id, $value )
  234. {
  235. $stuff = '<label for="' . $id .'">' . $value .'</label>'."\n";
  236. if( $this-> only == 1 )
  237. {
  238. echo $stuff;
  239. }
  240. elseif( $this-> c_fs_head == 1 )
  241. {
  242. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  243. $this-> FORM_INDEX++;
  244. }else echo "ERROR - Don't Fieldset HEAD define\n";
  245. }
  246. /////////////////////////////////////////////////////////////////////////////////
  247. // -----------------------------------------------------------------------------
  248. // NAME:
  249. // DESCRIPTION:
  250. // ARGUMENTS:
  251. // USES GLOBAL:
  252. // MODIFIES GL:
  253. // RETURNS:
  254. // DATE:
  255. // -----------------------------------------------------------------------------
  256. /////////////////////////////////////////////////////////////////////////////////
  257. public function fs_feed()
  258. {
  259. $stuff = '</fieldset>'."\n";
  260. if( $this-> only == 1 )
  261. {
  262. echo $stuff;
  263. }
  264. elseif( $this-> c_fs_head == 1 )
  265. {
  266. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  267. $this-> FORM_INDEX++;
  268. $this-> c_fs_feed = 1;
  269. }else echo "ERROR - Don't Fieldset HEAD define\n";
  270. }
  271. /////////////////////////////////////////////////////////////////////////////////
  272. // -----------------------------------------------------------------------------
  273. // NAME:
  274. // DESCRIPTION:
  275. // ARGUMENTS:
  276. // USES GLOBAL:
  277. // MODIFIES GL:
  278. // RETURNS:
  279. // DATE:
  280. // -----------------------------------------------------------------------------
  281. /////////////////////////////////////////////////////////////////////////////////
  282. public function input_text( $name, $value = NULL, $id = "", $ro = 0, $disabled = 0 )
  283. {
  284. $stuff = '<input ';
  285. if( strlen( $id ) > 0 )
  286. {
  287. $stuff = $stuff . 'id="' . $id . '" ';
  288. }
  289. $stuff = $stuff . 'name="' . $name . '" type="text" value="' . $value .'"';
  290. if( $ro == 1 )
  291. {
  292. $stuff = $stuff . ' readonly="readonly"';
  293. }
  294. if( $disabled == 1 )
  295. {
  296. $stuff = $stuff . ' disabled="disabled"';
  297. }
  298. $stuff = $stuff . '>'."\n";
  299. if( $this-> only == 1 )
  300. {
  301. echo $stuff;
  302. }
  303. elseif( $this-> c_head == 1 )
  304. {
  305. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  306. $this-> FORM_INDEX++;
  307. }else echo "ERROR - Don't HEAD define\n";
  308. }
  309. /////////////////////////////////////////////////////////////////////////////////
  310. // -----------------------------------------------------------------------------
  311. // NAME:
  312. // DESCRIPTION:
  313. // ARGUMENTS:
  314. // USES GLOBAL:
  315. // MODIFIES GL:
  316. // RETURNS:
  317. // DATE:
  318. // -----------------------------------------------------------------------------
  319. /////////////////////////////////////////////////////////////////////////////////
  320. public function input_password( $name, $value = NULL, $id = "" )
  321. {
  322. $stuff = '<input ';
  323. if( strlen( $id ) > 0 )
  324. {
  325. $stuff = $stuff . 'id="' . $id . '" ';
  326. }
  327. $stuff = $stuff . 'name="' . $name . '" type="password" value="' . $value . '">'."\n";
  328. if( $this-> only == 1 )
  329. {
  330. echo $stuff;
  331. }
  332. elseif( $this-> c_head == 1 )
  333. {
  334. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  335. $this-> FORM_INDEX++;
  336. }else echo "ERROR - Don't HEAD define\n";
  337. }
  338. /////////////////////////////////////////////////////////////////////////////////
  339. // -----------------------------------------------------------------------------
  340. // NAME:
  341. // DESCRIPTION:
  342. // ARGUMENTS:
  343. // USES GLOBAL:
  344. // MODIFIES GL:
  345. // RETURNS:
  346. // DATE:
  347. // -----------------------------------------------------------------------------
  348. /////////////////////////////////////////////////////////////////////////////////
  349. public function input_hidden( $name, $value = NULL, $id = "" )
  350. {
  351. $stuff = '<input ';
  352. if( strlen( $id ) > 0 )
  353. {
  354. $stuff = $stuff . 'id="' . $id . '" ';
  355. }
  356. $stuff = $stuff . 'name="' . $name . '" type="hidden" value="' . $value . '">'."\n";
  357. if( $this-> only == 1 )
  358. {
  359. echo $stuff;
  360. }
  361. elseif( $this-> c_head == 1 )
  362. {
  363. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  364. $this-> FORM_INDEX++;
  365. }else echo "ERROR - Don't HEAD define\n";
  366. }
  367. /////////////////////////////////////////////////////////////////////////////////
  368. // -----------------------------------------------------------------------------
  369. // NAME:
  370. // DESCRIPTION:
  371. // ARGUMENTS:
  372. // USES GLOBAL:
  373. // MODIFIES GL:
  374. // RETURNS:
  375. // DATE:
  376. // -----------------------------------------------------------------------------
  377. /////////////////////////////////////////////////////////////////////////////////
  378. public function checkbox( $name, $value = NULL, $id = "", $desc = NULL, $checked = 0)
  379. {
  380. $stuff = '<input ';
  381. if( strlen( $id ) > 0 )
  382. {
  383. $stuff = $stuff . 'id="' . $id . '" ';
  384. }
  385. $stuff = $stuff . 'type="checkbox" name="' . $name . '" value="' . $value . '"';
  386. if( $checked == 1 )
  387. {
  388. $stuff = $stuff . ' checked="checked"';
  389. }
  390. $stuff = $stuff . '>' . $desc ."\n";
  391. if( $this-> only == 1 )
  392. {
  393. echo $stuff;
  394. }
  395. elseif( $this-> c_head == 1 )
  396. {
  397. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  398. $this-> FORM_INDEX++;
  399. }else echo "ERROR - Don't HEAD define\n";
  400. }
  401. /////////////////////////////////////////////////////////////////////////////////
  402. // -----------------------------------------------------------------------------
  403. // NAME:
  404. // DESCRIPTION:
  405. // ARGUMENTS:
  406. // USES GLOBAL:
  407. // MODIFIES GL:
  408. // RETURNS:
  409. // DATE:
  410. // -----------------------------------------------------------------------------
  411. /////////////////////////////////////////////////////////////////////////////////
  412. public function radio( $name, $value = NULL, $id = "", $desc = NULL, $checked = 0 )
  413. {
  414. $stuff = '<input ';
  415. if( strlen( $id ) > 0 )
  416. {
  417. $stuff = $stuff . 'id="' . $id . '" ';
  418. }
  419. $stuff = $stuff . 'type="radio" name="' . $name . '" value="' . $value . '"';
  420. if( $checked == 1 && $this-> c_radio == 0 )
  421. {
  422. $stuff = $stuff . ' checked="checked"';
  423. $this-> c_radio = 1;
  424. }
  425. $stuff = $stuff . '>' . $desc ."\n";
  426. if( $this-> only == 1 )
  427. {
  428. echo $stuff;
  429. }
  430. elseif( $this-> c_head == 1 )
  431. {
  432. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  433. $this-> FORM_INDEX++;
  434. }else echo "ERROR - Don't HEAD define\n";
  435. }
  436. /////////////////////////////////////////////////////////////////////////////////
  437. // -----------------------------------------------------------------------------
  438. // NAME:
  439. // DESCRIPTION:
  440. // ARGUMENTS:
  441. // USES GLOBAL:
  442. // MODIFIES GL:
  443. // RETURNS:
  444. // DATE:
  445. // -----------------------------------------------------------------------------
  446. /////////////////////////////////////////////////////////////////////////////////
  447. public function upload( $name, $id = "", $accept = '*' )
  448. {
  449. $stuff = '<input ';
  450. if( strlen( $id ) > 0 )
  451. {
  452. $stuff = $stuff . 'id="' . $id . '" ';
  453. }
  454. $stuff = $stuff . 'name="' . $name . '" type="file" accept="' . $accept . '">'."\n";
  455. if( $this-> only == 1 )
  456. {
  457. echo $stuff;
  458. }
  459. elseif( $this-> c_head == 1 )
  460. {
  461. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  462. $this-> FORM_INDEX++;
  463. }else echo "ERROR - Don't HEAD define\n";
  464. }
  465. /////////////////////////////////////////////////////////////////////////////////
  466. // -----------------------------------------------------------------------------
  467. // NAME:
  468. // DESCRIPTION:
  469. // ARGUMENTS:
  470. // USES GLOBAL:
  471. // MODIFIES GL:
  472. // RETURNS:
  473. // DATE:
  474. // -----------------------------------------------------------------------------
  475. /////////////////////////////////////////////////////////////////////////////////
  476. public function textarea( $name, $cols, $rows, $value = NULL, $id = "", $ro = 0, $disabled = 0 )
  477. {
  478. $stuff = '<textarea ';
  479. if( strlen( $id ) > 0 )
  480. {
  481. $stuff = $stuff . 'id="' . $id . '" ';
  482. }
  483. $stuff = $stuff . 'name="' . $name . '" cols="' . $cols . '" rows="' . $rows . '"';
  484. if( $ro == 1 )
  485. {
  486. $stuff = $stuff . ' readonly="readonly"';
  487. }
  488. if( $disabled == 1 )
  489. {
  490. $stuff = $stuff . ' disabled="disabled"';
  491. }
  492. $stuff = $stuff . '>' . $value . '</textarea>'."\n";
  493. if( $this-> only == 1 )
  494. {
  495. echo $stuff;
  496. }
  497. elseif( $this-> c_head == 1 )
  498. {
  499. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  500. $this-> FORM_INDEX++;
  501. }else echo "ERROR - Don't HEAD define\n";
  502. }
  503. /////////////////////////////////////////////////////////////////////////////////
  504. // -----------------------------------------------------------------------------
  505. // NAME:
  506. // DESCRIPTION:
  507. // ARGUMENTS:
  508. // USES GLOBAL:
  509. // MODIFIES GL:
  510. // RETURNS:
  511. // DATE:
  512. // -----------------------------------------------------------------------------
  513. /////////////////////////////////////////////////////////////////////////////////
  514. public function submit( $name, $value, $id = "" )
  515. {
  516. $stuff = '<input ';
  517. if( strlen( $id ) > 0 )
  518. {
  519. $stuff = $stuff . 'id="' . $id . '" ';
  520. }
  521. $stuff = $stuff . 'type="submit" name="' . $name . '" value="' . $value . '">'."\n";
  522. if( $this-> only == 1 )
  523. {
  524. echo $stuff;
  525. }
  526. elseif( $this-> c_head == 1 )
  527. {
  528. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  529. $this-> FORM_INDEX++;
  530. }else echo "ERROR - Don't HEAD define\n";
  531. }
  532. /////////////////////////////////////////////////////////////////////////////////
  533. // -----------------------------------------------------------------------------
  534. // NAME:
  535. // DESCRIPTION:
  536. // ARGUMENTS:
  537. // USES GLOBAL:
  538. // MODIFIES GL:
  539. // RETURNS:
  540. // DATE:
  541. // -----------------------------------------------------------------------------
  542. /////////////////////////////////////////////////////////////////////////////////
  543. public function reset( $value, $id = "" )
  544. {
  545. $stuff = '<input ';
  546. if( strlen( $id ) > 0 )
  547. {
  548. $stuff = $stuff . 'id="' . $id . '" ';
  549. }
  550. $stuff = $stuff . 'type="reset" value="' . $value . '">'."\n";
  551. if( $this-> only == 1 )
  552. {
  553. echo $stuff;
  554. }
  555. elseif( $this-> c_head == 1 )
  556. {
  557. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  558. $this-> FORM_INDEX++;
  559. }else echo "ERROR - Don't HEAD define\n";
  560. }
  561. /////////////////////////////////////////////////////////////////////////////////
  562. // -----------------------------------------------------------------------------
  563. // NAME:
  564. // DESCRIPTION:
  565. // ARGUMENTS:
  566. // USES GLOBAL:
  567. // MODIFIES GL:
  568. // RETURNS:
  569. // DATE:
  570. // -----------------------------------------------------------------------------
  571. /////////////////////////////////////////////////////////////////////////////////
  572. public function button( $name, $value, $oc = "", $id = "" )
  573. {
  574. $stuff = '<input ';
  575. if( strlen( $id ) > 0 )
  576. {
  577. $stuff = $stuff . 'id="' . $id . '" ';
  578. }
  579. $stuff = $stuff . 'type="button" name="' . $name . '" value="' . $value . '" onclick="' . $oc . '">'."\n";
  580. if( $this-> only == 1 )
  581. {
  582. echo $stuff;
  583. }
  584. elseif( $this-> c_head == 1 )
  585. {
  586. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  587. $this-> FORM_INDEX++;
  588. }else echo "ERROR - Don't HEAD define\n";
  589. }
  590. /////////////////////////////////////////////////////////////////////////////////
  591. // -----------------------------------------------------------------------------
  592. // NAME:
  593. // DESCRIPTION:
  594. // ARGUMENTS:
  595. // USES GLOBAL:
  596. // MODIFIES GL:
  597. // RETURNS:
  598. // DATE:
  599. // -----------------------------------------------------------------------------
  600. /////////////////////////////////////////////////////////////////////////////////
  601. public function select_head( $name, $size, $multi = 0, $id = "" )
  602. {
  603. $stuff = '<select ';
  604. if( strlen( $id ) > 0 )
  605. {
  606. $stuff = $stuff . 'id="' . $id . '" ';
  607. }
  608. $stuff = $stuff . 'name="' . $name . '" size="' . $size . '"';
  609. if( $multi == 1 )
  610. {
  611. $stuff = $stuff . ' multiple="multiple"';
  612. $this-> c_select_multi = 1;
  613. }
  614. $stuff = $stuff . '>'."\n";
  615. if( $this-> only == 1 )
  616. {
  617. echo $stuff;
  618. }
  619. elseif( $this-> c_head == 1 )
  620. {
  621. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  622. $this-> FORM_INDEX++;
  623. $this-> c_select_head = 1;
  624. }else echo "ERROR - Don't HEAD define\n";
  625. }
  626. /////////////////////////////////////////////////////////////////////////////////
  627. // -----------------------------------------------------------------------------
  628. // NAME:
  629. // DESCRIPTION:
  630. // ARGUMENTS:
  631. // USES GLOBAL:
  632. // MODIFIES GL:
  633. // RETURNS:
  634. // DATE:
  635. // -----------------------------------------------------------------------------
  636. /////////////////////////////////////////////////////////////////////////////////
  637. public function s_group_head( $label )
  638. {
  639. $stuff = '<optgroup label="' . $label . '">'."\n";
  640. if( $this-> c_select_head == 1 )
  641. {
  642. if( $this-> only == 1 )
  643. {
  644. echo $stuff;
  645. }
  646. elseif( $this-> c_head == 1 )
  647. {
  648. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  649. $this-> FORM_INDEX++;
  650. $this-> c_select_group = 1;
  651. }else echo "ERROR - Don't HEAD define\n";
  652. }else echo "ERROR - Don't Select HEAD define\n";
  653. }
  654. /////////////////////////////////////////////////////////////////////////////////
  655. // -----------------------------------------------------------------------------
  656. // NAME:
  657. // DESCRIPTION:
  658. // ARGUMENTS:
  659. // USES GLOBAL:
  660. // MODIFIES GL:
  661. // RETURNS:
  662. // DATE:
  663. // -----------------------------------------------------------------------------
  664. /////////////////////////////////////////////////////////////////////////////////
  665. public function s_option( $name, $value, $selected = 0 )
  666. {
  667. $stuff = '<option';
  668. if( $this-> c_select_head == 1 )
  669. {
  670. if( $selected == 1 && $this-> c_select_selected == 0 )
  671. {
  672. $stuff = $stuff . ' selected="selected"';
  673. if( $this-> c_select_multi != 1 )
  674. {
  675. $this-> c_select_selected = 1;
  676. }
  677. }
  678. $stuff = $stuff . ' value="' . $value . '">' . $name . '</option>'."\n";
  679. if( $this-> only == 1 )
  680. {
  681. echo $stuff;
  682. }
  683. elseif( $this-> c_head == 1 )
  684. {
  685. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  686. $this-> FORM_INDEX++;
  687. $this-> c_select_group = 1;
  688. }else echo "ERROR - Don't HEAD define\n";
  689. }else echo "ERROR - Don't Select HEAD define\n";
  690. }
  691. /////////////////////////////////////////////////////////////////////////////////
  692. // -----------------------------------------------------------------------------
  693. // NAME:
  694. // DESCRIPTION:
  695. // ARGUMENTS:
  696. // USES GLOBAL:
  697. // MODIFIES GL:
  698. // RETURNS:
  699. // DATE:
  700. // -----------------------------------------------------------------------------
  701. /////////////////////////////////////////////////////////////////////////////////
  702. public function s_group_feed()
  703. {
  704. if( $this-> c_select_group == 1 )
  705. {
  706. $stuff = '</optgroup>'."\n";
  707. $this-> c_select_group = 0;
  708. }
  709. if( $this-> only == 1 )
  710. {
  711. echo $stuff;
  712. }
  713. elseif( $this-> c_head == 1 )
  714. {
  715. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  716. $this-> FORM_INDEX++;
  717. }else echo "ERROR - Don't HEAD define\n";
  718. }
  719. /////////////////////////////////////////////////////////////////////////////////
  720. // -----------------------------------------------------------------------------
  721. // NAME:
  722. // DESCRIPTION:
  723. // ARGUMENTS:
  724. // USES GLOBAL:
  725. // MODIFIES GL:
  726. // RETURNS:
  727. // DATE:
  728. // -----------------------------------------------------------------------------
  729. /////////////////////////////////////////////////////////////////////////////////
  730. public function select_feed()
  731. {
  732. if( $this-> c_select_head == 1 )
  733. {
  734. $stuff = '</select>'."\n";
  735. $this-> c_select_head = 0;
  736. $this-> c_select_multi = 0;
  737. $this-> c_select_selected = 0;
  738. if( $this-> only == 1 )
  739. {
  740. echo $stuff;
  741. }
  742. elseif( $this-> c_head == 1 )
  743. {
  744. $this-> FORM[$this-> FORM_INDEX] = $stuff;
  745. $this-> FORM_INDEX++;
  746. }else echo "ERROR - Don't HEAD define\n";
  747. }else echo "ERROR - Don't Select HEAD define\n";
  748. }
  749. }
  750. ?>

comments powered by Disqus