Solved

Php For Loop Form Data

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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.  …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

757 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

16 Experts available now in Live!

Get 1:1 Help Now