WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Form Submission Using Array's
Categories : PHP, HTML and PHP, Beginner Guides, Arrays Click here to Update Your Picture
Joseph Crawford
Date : May 25th 2004
Grade : 2 of 5 (graded 7 times)
Viewed : 10508
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Joseph Crawford
Action : Grade This Code Example
Tools : My Examples List

 
Like this code?
Show the author your appreciation.
Submit your own code examples 
 

Here is a small but useful feature i ran accross one day when i was trying to create a small questionaire for a client. The client had a questionaire that asked one main question and have 6-7 different sub questions such as what day would they like to see it happen, what color they feel would be best, etc...

When you create a form you have to come up with the name for each field that you use, if you have multiple fields relating to the same topic, you can use an array for the field names.

What would you like to see us do next?
A Forum Application named forum[]
What is the best color to use? ( Drop Down List Of Colors)

  <select name="forum[]">
   <option value="black">Black</option>
   <option value="blue">Blue</option>
   <option value="orange">Orange</option>
   <option value="red">Red</option>
   <option value="purple">Purple</option>
   <option value="green">Green</option>
   <option value="yellow">Yellow</option>
  </select>


Our Support Desk
1.) How Helpfull Has Our Staff Been? (Drop Down 1-7)
2.) Have Your Problems Been Solved? (Drop Down 1-7)
3.) Quality Of Support (Drop Down 1-7)

These could be implemented by using the following code

<!-- Drop Down For Support Question #1 -->
<select name="support[]">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select>

<!-- Drop Down For Support Question #2 -->
<select name="support[]">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select>

<!-- Drop Down For Support Question #3 -->
<select name="support[]">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select>


When you submit the form and your script takes over, you can use the values as

$_POST['forum'][0]

$_POST['support'][0]
$_POST['support'][1]
$_POST['support'][2]


i hope this short article has solved atleast one persons problem as if it has i have done my job in helping ;)



Select with current month
Categories : PHP, HTML and PHP, Date Time, Arrays
Tag content retrieval from websites with preg_match
Categories : PHP, Regexps, Arrays, HTML and PHP
How to pass an array from one PHP Script to another via an HTML form
Categories : PHP, HTML and PHP, Arrays
Print out array key => value in colored HTML
Categories : PHP, Arrays, HTML and PHP
Newbie Notes #1 - Making a form return to itself
Categories : PHP, Beginner Guides, HTML and PHP
How to preset a text string in a textarea input field
Categories : HTML, HTML and PHP, PHP, Beginner Guides
Beginners Array Functions
Categories : PHP, Beginner Guides, Arrays
dynamic table columns
Categories : PHP, HTML and PHP, Arrays, Databases, MySQL
Parsing html tags with php. Get an array from this function
Categories : PHP, HTML and PHP, Arrays, Tag Extractors
Simple PHP Form Field Generator
Categories : PHP, Beginner Guides, Form Processing, HTML and PHP
Random text quote
Categories : PHP, Arrays, Beginner Guides
Kewl Date Example
Categories : PHP, HTML and PHP, Date Time, CSS, Beginner Guides
mySQL/PHP/search with multientry form and table output with colored rows
Categories : PHP, Beginner Guides, MySQL, HTML and PHP, Databases
Multiple Select box, Select multiple Items from Menu.List box
Categories : PHP, HTML and PHP, Beginner Guides
Human readable PHP password generator
Categories : PHP, Security, Beginner Guides, Arrays