3 // $Id: plc_details.php 11645 2009-01-21 23:09:49Z thierry $
5 require_once 'plc_functions.php';
7 // the rationale behind having function names with _text is that
8 // the first functions that we had were actually printing the stuff instead of returning it
9 // so basically the foo (...) function should do ``print (foo_text(...))''
11 function plc_form_start ($url, $values, $options=array()) {
12 $method = array_key_exists('method',$options) ? $options['method'] : 'POST';
13 print "<form method=$method action='$url' enctype='multipart/form-data'>";
14 foreach ($values as $key=>$value) {
15 print "<input type=hidden name='$key' value='$value'>";
19 function plc_form_end($options=array()) {
23 function plc_form_checkbox_text ($name,$value,$selected=false) {
24 if ($selected) $xtra=" selected=selected";
25 return "<input type=checkbox name='$name' value='$value'$xtra>";
28 function plc_form_submit_text ($name,$display) {
29 return "<input type=submit name='$name' value='$display'>";
32 function plc_form_file_text ($name,$size) {
33 return "<input type=file name='$name' size=$size>";
36 function plc_form_label_text ($name,$display) {
37 return "<label for=$name>$display </label>";
40 function plc_form_select_text ($name,$values,$label="") {
42 $selector.="<select name='$name'>";
44 $selector.="<option value=''>$label</option>";
45 foreach ($values as $chunk) {
46 $display=$chunk['display'];
47 $value=$chunk['value'];
48 $selector .= "<option value='$value'>$display</option>\n";
50 $selector .= "</select>";