I have this php function that reads a text file for input to create a form. I am trying to get the form to print out the data on a separate page, but all I get is a blank page. Am I calling the page correctly, or is this even possible to do?
[code]
<?php $field=array(); $type=array(); $lines = file('test_read.txt'); foreach ($lines as $line) { list($mytype, $name, $option) = explode("=", $line); $name = htmlentities(trim($name)); if(isset($option)) $field[$name][]=htmlentities(trim($option)); else $field[$name]='nooptions'; $type[$name]=trim($mytype); } foreach ($field as $name => $options) { switch($type[$name]) { case 'label': print ("$name
n");
break;
case 'checkbox':
print ("$namen");
break;
case 'radio_button':
print ("
$name
n");
foreach($options as $value)
print ("$valuen");
break;
case 'comment_box':
print ("
$name
n");
print ("
n"); break; case 'textbox': print ("
$name: n"); break; case 'dropbox': print ("
$name: n"); foreach($options as $value) print ("$valuen"); print (""); break; } } print ("
n"); print ("n"); ?> [/code]
Text File (Just in case):
title = Test Form
label = Choose One of These
checkbox = shoe
checkbox = hair
radio_button = Choose One = 3
radio_button = Choose One = 6
comment_box = Comments
dropbox = Select = 18-29
dropbox = Select = 30-49
dropbox = Select = 50-75
textbox = Please type your name