|
|
|
|
|
|
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?
| |
|
|