Solved

Store random Form results within PHP variables

Posted on 2008-10-15
2
246 Views
Last Modified: 2013-12-13
Hello Experts,
I have some Javascript code which will strip "var user_id" into individual values (these values are randomly generated prior to being stored within this variable ), and the values are then written as hidden input fields like below.

My question is how can i then get php to store this data into separate variables, for each posted input field when i dont know what the values are going to be, nor how many separate instances of the input fields will be generated.
var user_id= "1##2##3##4##5##6##7##8##9##10";
 
<form action="test.php" method="get" accept-charset="utf-8">
 
<input type="hidden" name="1" value="1">
 
<input type="hidden" name="2" value="2">
 
<input type="hidden" name="3" value="3">
 
<input type="hidden" name="4" value="4">
 
<input type="hidden" name="5" value="5">
 
<input type="hidden" name="6" value="6">
 
<input type="hidden" name="7" value="7">
 
<input type="hidden" name="8" value="8">
 
<input type="hidden" name="9" value="9">
 
<input type="hidden" name="10" value="10">
</form>

Open in new window

0
Comment
Question by:agulaid
2 Comments
 
LVL 19

Accepted Solution

by:
BrianGEFF719 earned 500 total points
ID: 22728171
foreach($_GET as $key => $val)
{
 echo 'Variable: ' . $key . ' = ' . $val;
}

also, take a look at the fact that they are already in the get array:

print_r($_GET);
0
 

Author Closing Comment

by:agulaid
ID: 31506614
That works perfectly, thanks.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

821 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