Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin...
[phpmyadmin/lorilee.git] / enum_editor.php
blob4ab0d7f59017af26799e370de7a1b5f9b524f04d
1 <?php
2 require_once './libraries/common.inc.php';
4 require_once './libraries/header_http.inc.php';
5 require_once './libraries/header_meta_style.inc.php';
6 ?>
8 </head>
10 <body>
11 <form action="enum_editor.php" method="get">
12 <div id="enum_editor_no_js">
13 <h3>Values for the column "<?php echo $_GET['field']; ?>"</h3>
14 <p>Enter each value in a separate field.</p>
15 <div id="values">
16 <?php
17 // Get the new values from the submitted form or the old ones from tbl_alter.php
18 $values = '';
19 for($i = 1; $i <= $_GET['num_fields']; $i++) {
20 $input_name = "field" . $i;
21 $values .= $_GET[$input_name] . ',';
23 if (isset($_GET['values'])) {
24 $values = urldecode($_GET['values']);
26 // Display the input fields containing each of the values, removing the empty ones
27 $field_counter = 0;
28 $stripped_values = array();
29 foreach(split(",", $values) as $value) {
30 if(trim($value) != "") {
31 $field_counter++;
32 echo '<input type="text" size="30" value=' . $value . ' name="field' . $field_counter . '" />';
33 $stripped_values[] = $value;
36 // If extra fields are added, display them
37 if($_GET['add_extra_fields']) {
38 $extra_fields = $_GET['extra_fields'];
39 $total_fields = $extra_fields + $field_counter;
40 for($i = ($field_counter+1); $i <= $total_fields; $i++) {
41 echo '<input type="text" size="30" name="field' . $i . '"/>';
43 } else {
44 $total_fields = $field_counter;
47 </div>
48 <p>
49 <input type="checkbox" name="add_extra_fields"> Add <input type="text" value="1" name="extra_fields" size="2"/> more values
50 </p>
51 <input type="hidden" name="token" value="<?php echo $_GET['token']; ?>" />
52 <input type="hidden" name="num_fields" value="<?php echo $total_fields; ?>" />
53 <input type="hidden" name="field" value="<?php echo $_GET['field']; ?>" />
54 <input type="submit" value="Go" />
55 </form>
57 <div id="enum_editor_output">
58 <h3>Output</h3>
59 <p>Copy and paste the joined values into the "Length/Values" field</p>
60 <textarea id="joined_values" cols="95" rows="5"><?php echo join(",", $stripped_values); ?></textarea>
61 </div>
62 </div>
63 </body>
64 </html>