473,320 Members | 1,854 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,320 software developers and data experts.

Input data to fields in array?

I've got the following issue: in one form (1.php), I get the number of
inputs to offer, $input_cnt (it could be from 1-10, for example). In a
for loop, I then offer that number of input fields in the next form
(2.php):

for($cnt=1; $cnt<=$input_cnt; $cnt++) {
echo "<input type=\"text\" name=\"input.$cnt\">";
}

I get, for example, 'input.1', 'input.2', 'input.3', etc.

The issue I've got is getting this data back, once it's input to
fields I've offered in that form (3.php). I'd imagine it would be like
this, for example:

for($cnt=1; $cnt<=count($input); $cnt++) {
$input[$cnt] = $_POST['input'.$cnt];
}

I get nothing in output though if I then include this:

for($out=1; $out<=count($input); $out++) {
echo "$input[$out]";
}

I get no error, either. I'm not certain where the issue is; but I've
been getting nowhere with it on my own. I'd be grateful for any
insights..
Jul 17 '05 #1
1 2116
Oeln wrote:
I've got the following issue: in one form (1.php), I get the number of
inputs to offer, $input_cnt (it could be from 1-10, for example). In a
for loop, I then offer that number of input fields in the next form
(2.php):

for($cnt=1; $cnt<=$input_cnt; $cnt++) {
echo "<input type=\"text\" name=\"input.$cnt\">";
}

I get, for example, 'input.1', 'input.2', 'input.3', etc.

The issue I've got is getting this data back, once it's input to
fields I've offered in that form (3.php). I'd imagine it would be like
this, for example:

for($cnt=1; $cnt<=count($input); $cnt++) {
$input[$cnt] = $_POST['input'.$cnt];
}

I get nothing in output though if I then include this:

for($out=1; $out<=count($input); $out++) {
echo "$input[$out]";
}

I get no error, either. I'm not certain where the issue is; but I've
been getting nowhere with it on my own. I'd be grateful for any
insights..


http://www.php.net is a great place to look when you don't know how to do
something or do not understand something in PHP

The answer to your question is on the bottom of this page before the user
comments.

http://www.php.net/manual/en/languag...s.external.php

-Michael
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Oeln | last post by:
If I want to check for input of an integer I've got the following (I get the form input with $input = "$_POST"): if(!ereg("^+$",$_POST)) { echo "Input is incomplete or incorrect."; } If,...
4
by: Gleep | last post by:
Hi PHP coders, I've got an issue I'm stuck with. Imagine there is a large form that has 5 columns and 20 rows. In each row there is a check box - then 4 input fields. I already have the code...
4
by: Michael Kirchner | last post by:
Hi everybody The output of my multiple dimension array is quite confusing. Im declaring an array, store some values in it and then I save the array in a session variable. On an other page I...
7
by: Arnold | last post by:
I need to read a binary file and store it into a buffer in memory (system has large amount of RAM, 2GB+) then pass it to a function. The function accepts input as 32 bit unsigned longs (DWORD). I...
9
by: Randell D. | last post by:
Folks, I have a large amount of values to store (we're talking tens, if not hundreds of bytes). I need this for a client side application - ignore the security consequences for the moment -...
0
by: Bartas | last post by:
Hi, I'am writting a simple SOAP client in python (2.4) using SOAPpy lib. I've met with this problem: when I want to send a list of complex type using some method from WebService(java,WAS), ...
3
by: Bob Sanderson | last post by:
I am trying to create a form for a MySQL database similar to a spreadsheet. The idea is to display a list of records, with the last line of the list being an input form. When the user enters data...
3
ADezii
by: ADezii | last post by:
Last Tip, we demonstrated the technique for retrieving data from a DAO Recordset, and placing it into a 2-dimensional Array using the GetRows() Method. This week, we will cover the same exact Method...
2
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.