|
|
|
|
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 ;) |
|
| Using PHP im HTML image tags Categories : PHP, HTML and PHP, Graphics, Beginner Guides | | | Real simple example of removing HTML tags from text then changing \n (new line) to <br>. Could be used in a forum for instance. Categories : HTML, PHP, HTML and PHP, Beginner Guides | | | PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use! Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP | | | Link Submition - Allow your visitors to submit links to the site. Categories : PHP, Arrays, Filesystem, Beginner Guides | | | How to pass an array from one PHP Script to another via an HTML form Categories : PHP, HTML and PHP, Arrays | | | CSS style switcher Categories : PHP, CSS, HTML and PHP, Arrays, Sessions | | | dynamic table columns Categories : PHP, HTML and PHP, Arrays, Databases, MySQL | | | Simple script to passing persistent and growing array between recalls of one page (manipulate little stack). Categories : Arrays, Global Variables, PHP, HTML and PHP, Variables | | | Tag content retrieval from websites with preg_match Categories : PHP, Regexps, Arrays, HTML and PHP | | | 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 | | | mySQL/PHP/search with multientry
form and table output with colored rows Categories : PHP, Beginner Guides, MySQL, HTML and PHP, Databases | | | Select with current month Categories : PHP, HTML and PHP, Date Time, Arrays | | | Multiple Select box, Select multiple Items from Menu.List box Categories : PHP, HTML and PHP, Beginner Guides | | | navbar.php3 - Dynamic hyperlinked navigation bars Categories : HTML and PHP, Arrays, PHP, Complete Programs | |
| | | | 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?
| |
|
|