Solved

Php For Loop Form Data

Posted on 2013-01-29
2
234 Views
Last Modified: 2013-02-06
Hello I'm trying to get this for loop to work on data submitted on form i dont think i have the syntax correct on it

for ($i=1; $i<=25; $i++)
  {
  $message .= $i. ". " .$_REQUEST['state'.$1] "/" .$_REQUEST['county'.$1]. "/".$_REQUEST['searchfee'.$1]. "/".$_REQUEST['copyfee'.$1]. "/".$_REQUEST['recordingfee'.$1]. "/".$_REQUEST['miscfee'.$1]. "/".$_REQUEST['turntime'.$1]. "\n";
  }

Open in new window


There are 25 variables can you provide advice as to why this code is not working
0
Comment
Question by:akuss
2 Comments
 
LVL 16

Expert Comment

by:kmslogic
ID: 38832144
You are missing a dot after the first $_REQUEST
0
 
LVL 11

Accepted Solution

by:
mcnute earned 500 total points
ID: 38834757
Your snytax isn't entirely correct as kmslogic pointed out. Further I would use the appropriate request name such as post or get instead of the geral request method.

For better debugging add an error_reporting(E_ALL); at the top of your php document.
error_reporting(E_ALL); 
for ($i=1; $i<=25; $i++)
  {
  $message .= $i. ". " .$_REQUEST['state'.$1]. "/" .$_REQUEST['county'.$1]. "/".$_REQUEST['searchfee'.$1]. "/".$_REQUEST['copyfee'.$1]. "/".$_REQUEST['recordingfee'.$1]. "/".$_REQUEST['miscfee'.$1]. "/".$_REQUEST['turntime'.$1]. "\n";
  }

Open in new window


the error_reporting might reveal further syntax errors or other errors related to the 25 variables.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
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…

803 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