WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search


Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
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 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
פרייסז - השוואת מחירים בסופר
ZeroLag.com
Texas Holdem Poker Evangelists

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 8 times)
Viewed : 19353
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

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

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 ;)



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
navbar.php3 - Dynamic hyperlinked navigation bars
Categories : HTML and PHP, Arrays, PHP, Complete Programs
Human readable PHP password generator
Categories : PHP, Security, Beginner Guides, Arrays
Random text quote
Categories : PHP, Arrays, Beginner Guides
How to Create a Shoutbox Using PHP & MySQL
Categories : PHP, MySQL, Web Applications, Beginner Guides, HTML and PHP
How to display any array in several rows and columns of a table. Not just in one column or in alternate rows. This example shows a nice color table generated with PHP, but can be used with any array values(e.g. Database)
Categories : Arrays, PHP, Miscellaneous, Beginner Guides, Graphics
Link Submition - Allow your visitors to submit links to the site.
Categories : PHP, Arrays, Filesystem, Beginner Guides
Newbie Notes #9 - Hyperlinking a post
Categories : PHP, Java Script, HTML and PHP, Beginner Guides
Kewl Date Example
Categories : PHP, HTML and PHP, Date Time, CSS, Beginner Guides
PHP based HTML rabbing Tools
Categories : PHP, HTML and PHP, Tag Extractors, Regexps, Beginner Guides
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
Using PHP im HTML image tags
Categories : PHP, HTML and PHP, Graphics, Beginner Guides
Selecting a random line from a text file
Categories : PHP, Filesystem, Arrays, Beginner Guides
 A Hare wrote :1781
Would you be able to utilitze a FUNCTION as the method of
 calling the same option values for each question, being 
as the options are the same for each question, rather than 
typing the list for every question?