Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

php array from input hidden

Posted on 2004-08-25
4
Medium Priority
?
297 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 2000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

604 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