Expand|Select|Wrap|Line Numbers
- title = Test Form;
- checkbox = shoe;
- checkbox = hair;
- radio_button = 3;
- comment_box
- dropbox = 18-29;
- dropbox = 30-49;
- dropbox = 50-75;
- textbox = 50;
[PHP]<?php
$lines = file('test_read.txt');
foreach ($lines as $line) {
list($field, $value) = explode("=", $line);
$value = substr(trim($values), 0, 1);
echo get_html($field, $value);
}
function get_html($tag, $value) {
switch(trim($tag)) {
case 'checkbox':
return "<input type=\"checkbox\" name=\"userbox\" value=\"$value\">$value";
break;
case 'radio':
return "<input type=\"radio\" name=\"userbox\" value=\"$value\">$value";
break;
// more cases below if needed.
}
}
?>[/PHP]