469,645 Members | 1,424 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

Multiple field Arrays

Hello,

I have an quick question.

I have the following form:

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" >
<?php linecount = 5 ?>
<?php
for (i=0; i< linecount;i++)
{
<input type="text" name[] value=field1>
<input type="text" name[] value=field2>
<input type="text" name[] value=field3>
<input type="text" name[] value=field4>
<input type="text" name[] value=field5>
<input type="text" name[] value=field6>
}
</form>

Then I try to split up the data:
foreach ($_POST['name'] as $namef)
{
echo $namef."<br/>;

}

Here is the problem. The multiple fields seem not to be splitting up
because the output seems to coming out in a single blob.

What I would like to do is split up the array based upon the field
entry so I can insert the info into the database.

Thank you.

Kevin

Nov 4 '07 #1
3 1911
Kevin Davis wrote:
Hello,

I have an quick question.

I have the following form:

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" >
<?php linecount = 5 ?>
<?php
for (i=0; i< linecount;i++)
{
<input type="text" name[] value=field1>
<input type="text" name[] value=field2>
<input type="text" name[] value=field3>
<input type="text" name[] value=field4>
<input type="text" name[] value=field5>
<input type="text" name[] value=field6>
}
</form>

Then I try to split up the data:
foreach ($_POST['name'] as $namef)
{
echo $namef."<br/>;

}

Here is the problem. The multiple fields seem not to be splitting up
because the output seems to coming out in a single blob.

What I would like to do is split up the array based upon the field
entry so I can insert the info into the database.

Thank you.

Kevin

foreach ($_POST['name'] as $namef)
{
echo $namef."<br/>";
}

BTW - if you're using html, that should be <brinstead of <br/>.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Nov 4 '07 #2
Kevin Davis wrote:
Hello,

I have an quick question.

I have the following form:

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" >
<?php linecount = 5 ?>
<?php
for (i=0; i< linecount;i++)
{
<input type="text" name[] value=field1>
<input type="text" name[] value=field2>
<input type="text" name[] value=field3>
<input type="text" name[] value=field4>
<input type="text" name[] value=field5>
<input type="text" name[] value=field6>
}
</form>

Then I try to split up the data:
foreach ($_POST['name'] as $namef)
{
echo $namef."<br/>;

}

Here is the problem. The multiple fields seem not to be splitting up
because the output seems to coming out in a single blob.

What I would like to do is split up the array based upon the field
entry so I can insert the info into the database.

Thank you.

Kevin

Oops, pressed send too quick...

Also, your fields should be:

<input type="text" name="name[]" value=field1>

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Nov 4 '07 #3
In our last episode,
<11**********************@d55g2000hsg.googlegroups .com>, the lovely and
talented Kevin Davis broadcast on comp.lang.php:
Hello,
I have an quick question.
It is really an HTML question. Look up the input element in
your copy of the spec.
I have the following form:
><form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" >
<?php linecount = 5 ?>
<?php
for (i=0; i< linecount;i++)
{
<input type="text" name[] value=field1>
<input type="text" name[] value=field2>
<input type="text" name[] value=field3>
<input type="text" name[] value=field4>
<input type="text" name[] value=field5>
<input type="text" name[] value=field6>
}
</form>
Then I try to split up the data:
foreach ($_POST['name'] as $namef)
{
echo $namef."<br/>;
}
Here is the problem. The multiple fields seem not to be splitting up
because the output seems to coming out in a single blob.
What I would like to do is split up the array based upon the field
entry so I can insert the info into the database.
Thank you.
Kevin
--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
Countdown: 442 days to go.
What do you do when you're debranded?
Nov 5 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by R Duncan | last post: by
1 post views Thread by Darryl Woodford | last post: by
4 posts views Thread by Andrew | last post: by
5 posts views Thread by vj | last post: by
16 posts views Thread by Rehceb Rotkiv | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.