How To Create Make PHP Forms Using Form Arrays Tutorial
how to create make php forms using form arrays tutorial
how, to, create, make, php, forms, using, form, arrays, tutorial
How To Create Make PHP Forms Using Form Arrays Tutorial
Post Description: how to create make php forms using form arrays tutorial
POST# 418
Posted On: Fri Feb 29, 2008 12:01 pm
web hosting
Topic: How To Create Make PHP Forms Using Form Arrays Tutorial
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.



No Repies
(0) Comments for How To Create Make PHP Forms Using Form Arrays Tutorial

What do you think?

* name:  

* email:  

* Please enter comments:


Receive Replies on my Comments
(An email will be sent to you when someone replies to your comments)

Add image to comments
yes no             upload
     
  1. Warning: Mysql_fetch_array(): Supplied Argument Is Not A Valid MySQL Result
  2. Simple Array Example Learn PHP Programming Creating Arrays Learn Tutorial
  3. How To Create Make PHP Forms Using Form Arrays Tutorial
  4. How To Count And Break A Word Into An Array In Php Tutorial Guide
  5. How To Display Array Contents
  6. PHP Using For Loop To Display The Contents Of An Array
  7. How To Count Array Values Php Counting Arrays Holds Variables Script
  8. How To Use For Loop In Php Using Array Tutorial Sample Script
  9. Count And Display Words In A String Into Array Php Sentence Word
  10. How To Make Array Variable Global In PHP Function
  11. How To Count Elements In An Array Find How Many Values Arrays
  12. How To Check If Array Is Empty Or False Value
  13. How To Display Array Elements With Loop Get Show Array Values In PHP Tutorial
  14. How To Display Array Elements With FOR Loop
  15. Php Form Using Array For Field Name Template User Information
  16. Getting Array Elements Values With While Loop Show Display
  17. Display Array Elements Values With Loop
  18. How To Index Arrays And Show All The Elements And Values Of Array
  19. Php Show Values Array
  20. Php Html Display Array
  21. Making An Array From A Mysql Query