Faqts : Computers : Programming : Shopping For You : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

19 of 21 people (90%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

What is the best way to send an 'unknown' number of form fields and access them on the text page?

Jun 29th, 2009 07:12
khalid khalid, healthy man, dman, Jeroen Keppens, John McCaskill, http://www.jr7sa.com


<?
// First reset the array storing all values recieved from the form
reset ($HTTP_POST_VARS);   // if form method="post"
reset ($HTTP_GET_VARS);    // if form method="get"
// First way : with "while loop"
while (list($key, $value) = each ($HTTP_POST_VARS)) {
    echo "Key: $key; Value: $value<br>\n";
}
// Second way : with "foreach"
foreach ($HTTP_POST_VARS as $key => $value) {
    echo "Key: $key; Value: $value<br>\n";
}
?>
I hope this answers your question
Jeroen
http://www.jr7sa.com
http://www.jr7sa.com/msn
http://www.jr7sa.com/vb
http://www.jr7sa.com/1
http://www.jr7sa.com/wordpress
http://jr7sa.com/vb/f2.html
http://jr7sa.com/vb/f3.html
http://jr7sa.com/vb/f4.html
http://jr7sa.com/vb/f15.html
http://jr7sa.com/vb/f56.html
http://jr7sa.com/vb/f57.html
http://jr7sa.com/vb/f17.html
http://jr7sa.com/vb/f50.html
http://jr7sa.com/vb/f38.html
http://jr7sa.com/vb/f21.html
http://jr7sa.com/vb/f23.html
http://jr7sa.com/vb/f43.html
http://jr7sa.com/vb/f39.html
http://jr7sa.com/vb/f44.html
http://jr7sa.com/vb/f46.html
http://jr7sa.com/vb/f49.html
http://jr7sa.com/vb/f27.html
http://jr7sa.com/vb/f28.html
http://jr7sa.com/vb/f40.html
http://jr7sa.com/vb/f54.html
http://jr7sa.com/vb/cv_rss_feeds.php
http://www.jr7sa.com/vb/archive/index.php/
http://jr7sa.com/vb/f47.html
http://jr7sa.com/vb/f35.html
http://jr7sa.com/vb/external.php?type=RSS2
http://jr7sa.com/vb/jr7sa.com_vb_sitemap.xml
http://jr7sa.com/vb/sitemap.xml.gz
http://jr7sa.com/vb/sitemap_1.xml.gz
http://jr7sa.com/vb/sitemap_index.xml.gz
http://jr7sa.com/vb/urllist.txt.gz
http://www.jr7sa.com/sitemap.xml.gz
http://jr7sa.com/vb/sitemap.php
http://www.healthdothealth.com
http://www.healthxhealth.com
http://www.mesotheliomainmesothelioma.com
http://www.healthfirewall.com
http://www.flathealth.com
http://www.healthbodyguard.com