Solved

Store random Form results within PHP variables

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

746 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

12 Experts available now in Live!

Get 1:1 Help Now