473,395 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

field names in for loop

Hi,

If you go to http://projects.starcomsystems.net/golfcenter
then select number of rounds, the page reloads and copies the TeeTime and Day fields according to the number selected for rounds.

Currently its just a for loop which takes the querystring of rounds and copies the two fields. I need to know that how will we parse the copied fields values to the next page?

Currently I tried to simply name the two fields with the loop counting variable which is not be fetched on the next page and gives an error.

can some one please advise.

Regards
Ali
Mar 31 '07 #1
2 1395
devsusen
136 100+
Hi,

If you go to http://projects.starcomsystems.net/golfcenter
then select number of rounds, the page reloads and copies the TeeTime and Day fields according to the number selected for rounds.

Currently its just a for loop which takes the querystring of rounds and copies the two fields. I need to know that how will we parse the copied fields values to the next page?

Currently I tried to simply name the two fields with the loop counting variable which is not be fetched on the next page and gives an error.

can some one please advise.

Regards
Ali
I think you shouldn't have any error in fetching the fields. I am not sure why r u using Rnd in URL in form action part. Try to print all the form variable using
Expand|Select|Wrap|Line Numbers
  1. print_r($_REQUEST);
Then u will have an idea what r the value going in the next page.

susen
Mar 31 '07 #2
ronverdonk
4,258 Expert 4TB
I can, of course, not see how your php processing is done, but 'll give it a try.

When the number of rounds is entered, you can save that number in the form as a hidden field, say that number is in php variable $rounds, you append the next statement to the form:

[php]<input type='hidden' name='rnd' value='<? echo $rounds ?>' />[/php]
I can see that you assign the names of the fields using a counter, i.e. first tee date is in 'firstinput1', the second tee date is in 'firstinput2', etc. For the times the first tee time is in 'TeeTime1', the second in 'TeeTime2', etc.

When the form is submitted, first you do is to get the number of round from the $_POST string. Then you use this counter '$rnd' in a loop to process the tee dates and tee times and store them in an array, like this:

[php]
if (isset($_POST['rnd'])) {
$rnd = $_POST['rnd'];
$date_time=array();
for ($i=1; $i <= $rnd; $i++) {
$date_time[$i]['date'] = $_POST['firstinput'.$i];
$date_time[$i]['time'] = $_POST['TeeTime'.$i];
}
echo '<pre>'; print_r($date_time);
}
[/php]
The last statement prints out the array you built, so you can see what is in it. Good luck. When you have any more problems with this snippet or your script, let us know.

Ronald :cool:
Apr 1 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Amy | last post by:
I'm trying to add an autoincrementing id to a table based on an existing field Name, but Name has duplicated records. How can I do that in ACCESS? Thanks. Amy
1
by: Don Leverton | last post by:
Hi Folks, I have been given a CD with approx 130 .xls files (bean-counters!) that I would like to import and merge to ONE table (tblTradeshow). The XL files are *similarly*, but not...
1
by: Mal | last post by:
Hello. I have inherited a badly designed database and am trying to improve it. It is basically a flat file for survey results. one table holds, Name, Age etc as well as a field for each...
3
by: bitoulis | last post by:
Hi, is it possible to use the records of a table as the field names of another table? If yes, how is it done? Thanks in advance Laertes
2
by: dhnriverside | last post by:
Hi guys Ok, here's the situation. I'm building a reporting system for my application, that basically creates a CSV file based on a load of data in my database. I'm trying to make the...
3
by: Justin Clift | last post by:
Hi all, I'm creating a centralised table to keep a log of changes in other tables. In thinking about the PL/pgSQL trigger to write and attach to the monitored tables (probably a row level...
2
by: Tomdhu | last post by:
I've got a Contacts & Events database in Access 2K where contacts attend various events. At present, where I want to group e-mail all the attendees who are going to attend a particular event, I...
11
by: Tim Hunter | last post by:
Hi I am using WinXP and Access 2003 Is it possible to store the field names of a table in an array and then loop through the array and update the table using the field names stored in the array? I...
4
by: Bob | last post by:
Hi all, I've got a table that I've imported and it has junk at the top of the table, so after import I run a delete query to remove the junk lines then I'm left with the field names I want for...
19
by: JRough | last post by:
I have used this function to create a string called $headers: function GetHeaders($file_name){ return "<th><a href='".$file_name."&order_by=l_e'>L_E</a></th> <th><a href='"....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.