Solved

php array from input hidden

Posted on 2004-08-25
4
275 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
.php tree directory? 5 56
PHPStorm debugging issues 1 24
Amazon Redshift 2 27
mcrypt_create_iv() is deprecated 4 76
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now