topical media & game development
basic-php-appendix-ch06ex01.php / php
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<?php
//create the function to write the HTML tags
function createTags(field_type)
{
global option_text02,option_value01,option_value03;
switch (next_field = "<tr><td>field_type' name='next_field = "<tr><td>field_type' name='next_field = "<tr><td>field_type' name='next_field = "<tr><td>field_type' name='next_field = "<tr><td>field_name'></textarea></td></tr>";
break;
case "select";
field_name:</td><td><select name='option_value01'>option_value02'>option_value03'>next_field;
}
if (isset(field_name01 = field_name02 = field_name03 = field_type01 = field_type02 = field_type03 = field_type01 == "select" or field_type03 == "select") {
//display the Options form
?>
<form method="POST" action=<ch06ex01.php>>
<input type="hidden" name="posted01" value="true">
<input type="hidden" name="field_name01" value="<?php echo field_name02; ?>">
<input type="hidden" name="field_name03" value="<?php echo field_type01; ?>">
<input type="hidden" name="field_type02" value="<?php echo field_type03; ?>">
<table width="50%" border="0" cellpadding="6" align="center">
<tr>
<td width="50%"><b><font face="Arial, Helvetica, sans-serif" size="-1">Option
Text</font></b></td>
<td width="36%"><b><font face="Arial, Helvetica, sans-serif" size="-1">Option
Value</font></b></td>
</tr>
<tr>
<td width="50%">
<input type="text" name="option_text01">
</td>
<td width="36%">
<input type="text" name="option_value01">
</td>
</tr>
<tr>
<td width="50%">
<input type="text" name="option_text02">
</td>
<td width="36%">
<input type="text" name="option_value02">
</td>
</tr>
<tr>
<td width="50%">
<input type="text" name="option_text03">
</td>
<td width="36%">
<input type="text" name="option_value03">
</td>
</tr>
<tr>
<td width="50%"> </td>
<td width="36%">
<input type="submit" name="create_form" value="Create Options">
</td>
</tr>
</table>
</form>
<?php
} else {
//begin the table of fields
field_name01 != "" and my_form .= createTags(field_type01);
}
if (field_type02 != "") {
field_name02,field_name03 != "" and my_form .= createTags(field_type03);
}
//complete the table for fields
my_form";
}
} else if (isset(field_name01 = field_name02 = field_name03 = field_type01 = field_type02 = field_type03 = option_text01 = option_text02 = option_text03 = option_value01 = option_value02 = option_value03 = my_form = "<form method='POST' action='ch06ex01.php'><table width='50%' border='1'>";
//construct and display the form made by the user
if (field_type01 != "") {
field_name01,field_name02 != "" and my_form .= createTags(field_type02);
}
if (field_type03 != "") {
field_name03,my_form .= "<tr><td><input type='submit' value='Send'></td></tr></table></form>";
echo "
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.