?
Solved

Php For Loop Form Data

Posted on 2013-01-29
2
Medium Priority
?
241 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 2000 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

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month17 days, 10 hours left to enroll

830 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