LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-03-2005, 02:31 AM   #1
prabhatsoni
Member
 
Registered: Oct 2004
Location: India
Distribution: FC 12
Posts: 233

Rep: Reputation: 30
passing an array from html-forms to php


Hello everybody,
we can use php variable $_POST for passing varibles like user_name etc. But when there are a large number of variables, the manual says we should use arrays in html-forms. I have not been able to access these array elements from php sscripts. The manual is silent as to how should we refer to these arrays-elements of html-forms from php side.

Can anyone guide me in this ? Pllease give a small exmaple to the syntax of referring these array elementts from php.


Thanks a lot in advance.

Prabhat Soni
 
Old 06-03-2005, 02:48 AM   #2
albertvandam
LQ Newbie
 
Registered: Oct 2004
Location: South Africa
Distribution: SuSE 8.0 / SuSE 9.1 / SuSE 9.2 / Previously: RH5 / RH6 / RH7.1 / RH9 / MDK7.1
Posts: 1

Rep: Reputation: 0
Your form:
Code:
<form name="myFrm" action="theAction.php" method="post">
  F1: <input type="text" name=aF[]><br>
  F2: <input type="text" name=aF[]><br>
  F3: <input type="text" name=aF[]><br>
  F4: <input type="text" name=aF[]><br>
  F5: <input type="text" name=aF[]><br>
  F6: <input type="text" name=aF[]><br>
  F7: <input type="text" name=aF[]><br>
  F8: <input type="text" name=aF[]><br>
  F9: <input type="text" name=aF[]><br>
  F10: <input type="text" name=aF[]><br>
</form>
Your PHP:
Code:
  $formResult = $_POST['aF'];
  for ($aCntr = 0; $aCntr < count($formResult); $aCntr++) {
    echo $formResult[$aCntr]."<br>";
  }
 
Old 06-04-2005, 12:11 AM   #3
prabhatsoni
Member
 
Registered: Oct 2004
Location: India
Distribution: FC 12
Posts: 233

Original Poster
Rep: Reputation: 30
It wroks !!

Thanks a lot Albertvandam for helping out a greenhorn like me.



Prabhat Soni
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing form values between multiple forms!! AskMe Programming 5 09-07-2005 07:44 PM
MySQL results to html forms using PHP xemous Programming 3 08-15-2005 03:27 PM
Forms in HTML J_K9 Programming 5 06-30-2005 02:21 PM
HTML Forms belorion Programming 1 02-01-2005 11:41 PM
HTML, PHP, forms, submitting data Problem Silent1 Programming 3 08-31-2004 03:03 PM


All times are GMT -5. The time now is 09:34 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration