for a while now, i've been meaning to tackle this. as a webmaster, i create alot of form, and i though there's gotta be a faster and easier way to creat forms with code instead of having to write down every sincle field manually.

well, so far, i got as fas a creating a simple form with an array. this little code uses HTML and PHP to create a form by using arrays as the name of the fields. the arrays are the value of each field so all i have to do its tell the script how many fields i want to have.

im working on the next step. for future release of this script, i hope i can have it where you can configure what type of field you want, like for example, button, text, textarea, option select etc.. and give the name of the field. but for now, this is what i have, maybe someone can help me get it to the next level.

<h1>PHP Form With Arrays by <a href="http://www.webune.com">Webune.com</a></h1>
<hr>
<?
# CONFGURE
// NUMBER OF FIELDS YOU WANT
$num_fields = 10;
function clean ($form_string) {
$form_string = trim(stripslashes($form_string));
return $form_string;
}
?>
<form action="" method="post">
<?
for($counter =1; $counter <= 10; $counter++)
{

echo $field_name[$counter].'<input type="'.$field_type[$counter].'" name="user['.$counter.']" value="'.$_POST['user'][$counter].'" /><br>'."\n";
}
?>
<input type=submit name="Submit" value="Submit" />
</form>
<?php
if(isset($_REQUEST['Submit']))
{
foreach($_POST['user'] as $key => $line) {
$user = clean($line);
print("\n<br />The Value of User[" . $key . '] is: ' . $user);
}
}
?>
<h1 align="center">PHP Hosting at <a href="http://www.webune.com">Webune.com</a></h1>



to see this code provided by www.webune.com simple open a blank notepad and copy and paste the code above and save the file as webuneform.php and upload to your php website and see it in action.

NOTE: you must have php on your website, if you don't have php yet, you can sign up with webune.com they have excellent service. i always choose www.webune.com for my web hosting. infact, they are the ones who helped me with this script.