Solved

Store random Form results within PHP variables

Posted on 2008-10-15
2
242 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

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

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
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.

863 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

20 Experts available now in Live!

Get 1:1 Help Now