?
Solved

Store random Form results within PHP variables

Posted on 2008-10-15
2
Medium Priority
?
278 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
[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
2 Comments
 
LVL 19

Accepted Solution

by:
BrianGEFF719 earned 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
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…
Suggested Courses

649 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