<!doctype html public "-//W3C//DTD html 4.0 //en">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<meta name="Author" content="BigProf Software">
	<title>Free HTML form generator online</title>
	<meta Name="description" Content="This is an online wizard to generate HTML forms, free of charge.">
	<meta Name="keywords" Content="HTML,form,generator,wizard,free,online">
	<link rel="stylesheet" type="text/css" href="formgen.css">

	<script language="javaScript">
		<!--
		function adjustForm(){
			var fType=document.getElementById("formFieldType").value;
			
			// reset form
			switch(fType){
				case "text":
					document.getElementById("formFieldCaption").disabled=false;
					document.getElementById("formFieldRows").disabled=true;
					document.getElementById("formFieldMaxLength").disabled=false;
					document.getElementById("formFieldOptions").disabled=true;
					document.getElementById("formFieldName").disabled=false;
					document.getElementById("formFieldCols").disabled=true;
					document.getElementById("formFieldAccessKey").disabled=false;
					document.getElementById("formFieldAlt").disabled=true;
					document.getElementById("formFieldSrc").disabled=true;
					document.getElementById("formFieldSelected").disabled=true;
					document.getElementById("formFieldClass").disabled=false;
					document.getElementById("formFieldSize").disabled=false;
					document.getElementById("formFieldValue").disabled=false;
					document.getElementById("formFieldReadOnly").disabled=false;
					document.getElementById("formFieldDisabled").disabled=false;
					document.getElementById("formFieldTitle").disabled=false;
					document.getElementById("formFieldChecked").disabled=true;
					document.getElementById("formClose").disabled=false;
					break;
				case "password":
					document.getElementById("formFieldCaption").disabled=false;
					document.getElementById("formFieldRows").disabled=true;
					document.getElementById("formFieldMaxLength").disabled=false;
					document.getElementById("formFieldOptions").disabled=true;
					document.getElementById("formFieldName").disabled=false;
					document.getElementById("formFieldCols").disabled=true;
					document.getElementById("formFieldAccessKey").disabled=false;
					document.getElementById("formFieldAlt").disabled=true;
					document.getElementById("formFieldSrc").disabled=true;
					document.getElementById("formFieldSelected").disabled=true;
					document.getElementById("formFieldClass").disabled=false;
					document.getElementById("formFieldSize").disabled=false;
					document.getElementById("formFieldValue").disabled=false;
					document.getElementById("formFieldReadOnly").disabled=false;
					document.getElementById("formFieldDisabled").disabled=false;
					document.getElementById("formFieldTitle").disabled=false;
					document.getElementById("formFieldChecked").disabled=true;
					document.getElementById("formClose").disabled=false;
					break;
				case "checkBox":
					document.getElementById("formFieldCaption").disabled=false;
					document.getElementById("formFieldRows").disabled=true;
					document.getElementById("formFieldMaxLength").disabled=true;
					document.getElementById("formFieldOptions").disabled=true;
					document.getElementById("formFieldName").disabled=false;
					document.getElementById("formFieldCols").disabled=true;
					document.getElementById("formFieldAccessKey").disabled=false;
					document.getElementById("formFieldAlt").disabled=true;
					document.getElementById("formFieldSrc").disabled=true;
					document.getElementById("formFieldSelected").disabled=true;
					document.getElementById("formFieldClass").disabled=false;
					document.getElementById("formFieldSize").disabled=true;
					document.getElementById("formFieldValue").disabled=false;
					document.getElementById("formFieldReadOnly").disabled=false;
					document.getElementById("formFieldDisabled").disabled=false;
					document.getElementById("formFieldTitle").disabled=false;
					document.getElementById("formFieldChecked").disabled=false;
					document.getElementById("formClose").disabled=false;
					break;
				case "radio":
					document.getElementById("formFieldCaption").disabled=false;
					document.getElementById("formFieldRows").disabled=true;
					document.getElementById("formFieldMaxLength").disabled=true;
					document.getElementById("formFieldOptions").disabled=true;
					document.getElementById("formFieldName").disabled=false;
					document.getElementById("formFieldCols").disabled=true;
					document.getElementById("formFieldAccessKey").disabled=false;
					document.getElementById("formFieldAlt").disabled=true;
					document.getElementById("formFieldSrc").disabled=true;
					document.getElementById("formFieldSelected").disabled=false;
					document.getElementById("formFieldClass").disabled=false;
					document.getElementById("formFieldSize").disabled=true;
					document.getElementById("formFieldValue").disabled=false;
					document.getElementById("formFieldReadOnly").disabled=false;
					document.getElementById("formFieldDisabled").disabled=false;
					document.getElementById("formFieldTitle").disabled=false;
					document.getElementById("formFieldChecked").disabled=true;
					document.getElementById("formClose").disabled=false;
					break;
				case "textArea":
					document.getElementById("formFieldCaption").disabled=false;
					document.getElementById("formFieldRows").disabled=false;
					document.getElementById("formFieldMaxLength").disabled=true;
					document.getElementById("formFieldOptions").disabled=true;
					document.getElementById("formFieldName").disabled=false;
					document.getElementById("formFieldCols").disabled=false;
					document.getElementById("formFieldAccessKey").disabled=false;
					document.getElementById("formFieldAlt").disabled=true;
					document.getElementById("formFieldSrc").disabled=true;
					document.getElementById("formFieldSelected").disabled=true;
					document.getElementById("formFieldClass").disabled=false;
					document.getElementById("formFieldSize").disabled=true;
					document.getElementById("formFieldValue").disabled=false;
					document.getElementById("formFieldReadOnly").disabled=false;
					document.getElementById("formFieldDisabled").disabled=false;
					document.getElementById("formFieldTitle").disabled=false;
					document.getElementById("formFieldChecked").disabled=true;
					document.getElementById("formClose").disabled=false;
					break;
				default:
					document.getElementById("formFieldCaption").disabled=true;
					document.getElementById("formFieldRows").disabled=true;
					document.getElementById("formFieldMaxLength").disabled=true;
					document.getElementById("formFieldOptions").disabled=true;
					document.getElementById("formFieldName").disabled=true;
					document.getElementById("formFieldCols").disabled=true;
					document.getElementById("formFieldAccessKey").disabled=true;
					document.getElementById("formFieldAlt").disabled=true;
					document.getElementById("formFieldSrc").disabled=true;
					document.getElementById("formFieldSelected").disabled=true;
					document.getElementById("formFieldClass").disabled=true;
					document.getElementById("formFieldSize").disabled=true;
					document.getElementById("formFieldValue").disabled=true;
					document.getElementById("formFieldReadOnly").disabled=true;
					document.getElementById("formFieldDisabled").disabled=true;
					document.getElementById("formFieldTitle").disabled=true;
					document.getElementById("formFieldChecked").disabled=true;
					document.getElementById("formClose").disabled=true;
			}
		}
		
		//-->
		</script>

	</head>
<body onLoad="adjustForm();">
 
<?
	foreach($HTTP_POST_VARS as $var=>$val){
		$HTTP_POST_VARS[$var]=strip_tags($val);
	}
?>
<form action="<?=$HTTP_SERVER_VARS['PHP_SELF']?>" method=post>


<?
	if($HTTP_POST_VARS['action']=="Close form"){
		$FormCode = "\n</table></form>";
		?>
		<div class="Title">
			Form ready now!<br><br>
			Just copy the code below into
			your html file. To begin a new form, 
			<a href="<?=$HTTP_SERVER_VARS['PHP_SELF']?>">click here</a>.
		</div>
		<?
	}
	elseif($HTTP_POST_VARS['action']=="Add element" || $HTTP_POST_VARS['action']=="Create form"){
		?>
		<!-- Display Add form field section -->

		<table width=750 border=0>
		<tr><td class="Contents">
			<div class="Partition">
			
			<div class="Title" style="background-color:#DDDDDD;">Add new form field</div>
			<table class="Contents" width=100%>
			
			<tr>
				
				<td valign="middle" align="center" rowspan=10 bgcolor="#DDDDDD">
					<b>Element</b><br>
					<select name="formFieldType" id="formFieldType" class="Contents" onChange="adjustForm();">
						<option value="">&lt;Select Element&gt;</option>
						<option value="text">Text box</option>
						<option value="password">Password</option>
						<option value="checkBox">Checkbox</option>
						<option value="radio">Radio button</option>
						<option value="textArea">Text area</option>
						<option value="file">File upload</option>
						<option value="image">Image submit</option>
						<option value="select">Drop down menu</option>
						<option value="button">Button</option>
						<option value="submit">Submit button</option>
						<option value="reset">Reset button</option>
						<option value="hidden">Hidden</option>
					</select>
				</td>
				
				<td>
					Caption<br>
					<input type="text" name="formFieldCaption" id="formFieldCaption" size="20">
				</td>
				
				<td>
					Name<br>
					<input type="text" name="formFieldName" id="formFieldName" size="10">
				</td>
				
				<td>
					Size<br>
					<input type="text" name="formFieldSize" id="formFieldSize" size="5">
				</td>
				
			</tr>
			
			<tr>
				
				<td>
					Rows<br>
					<input type="text" name="formFieldRows" id="formFieldRows" size="5">
				</td>
				
				<td>
					Columns<br>
					<input type="text" name="formFieldCols" id="formFieldCols" size="5">
				</td>
				
				<td>
					Default value<br>
					<input type="text" name="formFieldValue" id="formFieldValue" size="20">
				</td>
				
			</tr>
			
			<tr>
				
				<td>
					Max length<br>
					<input type="text" name="formFieldMaxLength" id="formFieldMaxLength" size="5">
				</td>
				
				<td>
					Shortcut key, &lt;ALT&gt; +<br>
					<input type="text" name="formFieldAccessKey" id="formFieldAccessKey" size="5">
				</td>
				
				<td>
					Read only?<br>
					<input type="checkbox" name="formFieldReadOnly" id="formFieldReadOnly" value="1">
				</td>
				
			</tr>
			
			<tr>
				
				<td rowspan=5>
					List contents (one item per line)<br>
					<textarea name="formFieldOptions" cols=20 id="formFieldOptions" rows=9></textarea>
				</td>
				
				<td valign="top">
					Image alternative (alt) text<br>
					<input type="text" name="formFieldAlt" id="formFieldAlt" size="20">
				</td>
				
				<td valign="top">
					Disabled?<br>
					<input type="checkbox" name="formFieldDisabled" id="formFieldDisabled" value="1">
				</td>
				
			</tr>
			
			<tr>
			
				<td valign="top">
					Image file<br>
					<input type="text" name="formFieldSrc" id="formFieldSrc" size="20">
				</td>
				
				<td valign="top">
					Tool tip text<br>
					<input type="text" name="formFieldTitle" id="formFieldTitle" size="20">
				</td>
				
			</tr>

			<tr>
			
				<td valign="top">
					Selected? (for radio buttons)<br>
					<input type="checkbox" name="formFieldSelected" id="formFieldSelected">
				</td>
				
				<td valign="top">
					Checked? (for check boxes)<br>
					<input type="checkbox" name="formFieldChecked" id="formFieldChecked">
				</td>
				
			</tr>
			
			<tr>
			
				<td valign="top">
					CSS class<br>
					<input type="text" name="formFieldClass" id="formFieldClass" size="10">
				</td>
				
				<td valign="bottom" align="right">
					<input type="submit" name="action" value="Add element" id="formClose">
					<input type="submit" name="action" value="Close form">
				</td>
				
			</tr>
			
			</table>
		
			</div>
		</td></tr>
		</table>
		<?
		if($HTTP_POST_VARS['action']=="Create form"){
			$FormCode  = "<form method=\"" . $HTTP_POST_VARS['formMethod'] . "\" ";
			$FormCode .= "action=\"" . $HTTP_POST_VARS['formAction'] . "\" ";
			$FormCode .= "target=\"" . $HTTP_POST_VARS['formTarget'] . "\" ";
			$FormCode .= "name=\"" . $HTTP_POST_VARS['formName'] . "\"><table dir=\"" . $HTTP_POST_VARS['formDir'] . "\" class=\"" . $HTTP_POST_VARS['formClass'] . "\">\n";
		}else{
			$type=$HTTP_POST_VARS['formFieldType'];
			if($type=="text" || $type=="password" || $type=="file" || $type=="image" || $type=="button" || $type=="submit" || $type=="reset" || $type=="hidden"){
				$FormCode  = "\t<tr>\n";
				$FormCode .= "\t\t<td align=\"right\">" . $HTTP_POST_VARS['formFieldCaption'] . "</td>\n";
				$FormCode .= "\t\t<td><input type=\"$type\" ";
				$FormCode .= "accesskey=\"" . $HTTP_POST_VARS['formFieldAccessKey'] . "\" ";
				$FormCode .= "alt=\"" . $HTTP_POST_VARS['formFieldAlt'] . "\" ";
				$FormCode .= "name=\"" . $HTTP_POST_VARS['formFieldName'] . "\" ";
				$FormCode .= "size=\"" . $HTTP_POST_VARS['formFieldSize'] . "\" ";
				$FormCode .= "src=\"" . $HTTP_POST_VARS['formFieldSrc'] . "\" ";
				$FormCode .= "value=\"" . $HTTP_POST_VARS['formFieldValue'] . "\" ";
				$FormCode .= "maxlength=\"" . $HTTP_POST_VARS['formFieldMaxLength'] . "\" ";
				$FormCode .= "title=\"" . $HTTP_POST_VARS['formFieldTitle'] . "\" ";
				$FormCode .= "class=\"" . $HTTP_POST_VARS['formFieldClass'] . "\" ";
				$FormCode .= $HTTP_POST_VARS['formFieldReadOnly']==1 ? "readonly " : "";
				$FormCode .= $HTTP_POST_VARS['formFieldDisabled']==1 ? "disabled" : "";
				$FormCode .= "></td>\n\t\t</tr>\n";
			}elseif($type=="checkBox" || $type=="radio"){
				$FormCode  = "\t<tr>\n";
				$FormCode .= "\t\t<td><input type=\"$type\" ";
				$FormCode .= "accesskey=\"" . $HTTP_POST_VARS['formFieldAccessKey'] . "\" ";
				$FormCode .= "name=\"" . $HTTP_POST_VARS['formFieldName'] . "\" ";
				$FormCode .= "value=\"" . $HTTP_POST_VARS['formFieldValue'] . "\" ";
				$FormCode .= "title=\"" . $HTTP_POST_VARS['formFieldTitle'] . "\" ";
				$FormCode .= "class=\"" . $HTTP_POST_VARS['formFieldClass'] . "\" ";
				$FormCode .= $HTTP_POST_VARS['formFieldReadOnly']==1 ? "readonly " : "";
				$FormCode .= $HTTP_POST_VARS['formFieldDisabled']==1 ? "disabled " : "";
				$FormCode .= $HTTP_POST_VARS['formFieldChecked']==1 ? "checked " : "";
				$FormCode .= $HTTP_POST_VARS['formFieldSelected']==1 ? "selected" : "";
				$FormCode .= "></td>\n";
				$FormCode .= "\t\t<td align=\"right\">" . $HTTP_POST_VARS['formFieldCaption'] . "</td>\n\t\t</tr>\n";
			}elseif($type=="textArea"){
				$FormCode  = "\t<tr>\n";
				$FormCode .= "\t\t<td align=\"right\">" . $HTTP_POST_VARS['formFieldCaption'] . "</td>\n";
				$FormCode .= "\t\t<td><textarea ";
				$FormCode .= "accesskey=\"" . $HTTP_POST_VARS['formFieldAccessKey'] . "\" ";
				$FormCode .= "cols=\"" . $HTTP_POST_VARS['formFieldCols'] . "\" ";
				$FormCode .= "rows=\"" . $HTTP_POST_VARS['formFieldRows'] . "\" ";
				$FormCode .= "name=\"" . $HTTP_POST_VARS['formFieldName'] . "\" ";
				$FormCode .= "title=\"" . $HTTP_POST_VARS['formFieldTitle'] . "\" ";
				$FormCode .= "class=\"" . $HTTP_POST_VARS['formFieldClass'] . "\" ";
				$FormCode .= $HTTP_POST_VARS['formFieldReadOnly']==1 ? "readonly " : "";
				$FormCode .= $HTTP_POST_VARS['formFieldDisabled']==1 ? "disabled" : "";
				$FormCode .= ">" . $HTTP_POST_VARS['formFieldValue'] . "</textarea></td>\n\t\t</tr>\n";
			}elseif($type=="select"){
				$FormCode  = "\t<tr>\n";
				$FormCode .= "\t\t<td align=\"right\">" . $HTTP_POST_VARS['formFieldCaption'] . "</td>\n";
				$FormCode .= "\t\t<td><select ";
				$FormCode .= "accesskey=\"" . $HTTP_POST_VARS['formFieldAccessKey'] . "\" ";
				$FormCode .= "name=\"" . $HTTP_POST_VARS['formFieldName'] . "\" ";
				$FormCode .= "size=\"" . $HTTP_POST_VARS['formFieldSize'] . "\" ";
				$FormCode .= "class=\"" . $HTTP_POST_VARS['formFieldClass'] . "\" ";
				$FormCode .= $HTTP_POST_VARS['formFieldDisabled']==1 ? "disabled" : "";
				$FormCode .= ">\n";
				$options = explode("\n", $HTTP_POST_VARS['formFieldOptions']);
				foreach($options as $option){
					$option = trim($option);
					$FormCode .= "\t\t\t<option value=\"$option\">$option</option>\n";
				}
				$FormCode .= "\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n";
			}
		}

	}else{
		?>
		
		<table class="Contents" width="750">
		<tr>
			<td class="Partition">
				<div class="Title">Create a new form</div>

				<table class="Contents" width=100%>
					
					<tr>
						
						<td>
							Method<br>
							<select name="formMethod" class="Contents">
								<option value="post">Post &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</option>
								<option value="get">Get &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</option>
							</select>
						</td>
						
						<td>
							Action<br>
							<input type="text" name="formAction" size="30">
						</td>
						
						<td>
							Target window<br>
							<input type="text" name="formTarget" value="_self" size="15">
						</td>
						
						<td>
							Name<br>
							<input type="text" name="formName" size="15">
						</td>
					</tr>
					
					<tr>
						<td>
							Direction<br>
							<select name="formDir" class="Contents">
								<option value="ltr">Left to right</option>
								<option value="rtl">Right to left</option>
								</select>
						</td>

						<td>
							Class<br>
							<input type="text" name="formClass" size="15">
						</td>

						<td align="right" colspan="2">
							<input type="submit" name="action" value="Create form">
						</td>
					</tr>
					
					</table>
				
					</div>
				</td></tr>
			</table>

			</td>
		</tr>
		</table>
	
		<?
	}
	
	$FormCode = $HTTP_POST_VARS['formCode'] . urlencode($FormCode);
	
	?>
	

	<br><hr size="1" color="red">
	<div class="Title">HTML Code:</div>
	<pre><?=htmlspecialchars(urldecode($FormCode))?></pre>
	<input type="hidden" name="formCode" value="<?=$FormCode?>">

</form>

</body>
</html>