Solved

php array from input hidden

Posted on 2004-08-25
4
287 Views
Last Modified: 2010-05-18
Is it possible to grab a bunch of values from an html page, put them in a hidden,
and then have a php script process the value of the hidden like

foreach ($hiddenArray as $var) {

}
0
Comment
Question by:warrenlyle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 27

Expert Comment

by:Diablo84
ID: 11893833
if you had multiple hidden fields they would each have to be called name[]

example

<input type="hidden" name="iput[]" value="something">
<input type="hidden" name="iput[]" value="something else">
<input type="hidden" name="iput[]" value="another thing">
<input type="hidden" name="iput[]" value="one more thing">

then on the processing page

$hiddenArray = $_POST['iput'];

foreach ($hiddenArray as $var) {
 //do something with each value
}
0
 
LVL 27

Accepted Solution

by:
Diablo84 earned 500 total points
ID: 11893862
if you wanted them all in one hidden field, which may for example look like this

<input type="hidden" name="iput" value="something,something else,another thing,one more thing">

you would then do

$hiddenArray = $_POST['iput'];

$components = explode(",",$hiddenArray); //where as , is the string seperator, you could of course use something else like |

foreach ($components as $var) {
 //do something with each value
}
0
 

Author Comment

by:warrenlyle
ID: 11893997
thanks!!
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11894009
no problem :)

|)iablo
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question