Solved

Php For Loop Form Data

Posted on 2013-01-29
2
233 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

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

Suggested Solutions

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.  …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
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.
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 …

911 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

18 Experts available now in Live!

Get 1:1 Help Now