473,692 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2066
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*******@attgl obal.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*******@attgl obal.net
=============== ===

Nov 4 '07 #3
In our last episode,
<11************ **********@d55g 2000hsg.googleg roups.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5210
by: R Duncan | last post by:
Hi, I'm considering moving a payroll application out of Microsoft Access to some web-based solution. It is getting way to big for Access and the system is growing unstable, so I'm learning PHP and MySQL and things are looking very promising. There is one piece of this I am having problems with. The attendance module shows users all their employees in a table and allows them edit it this way. My users need to be able to see and update...
1
8123
by: Darryl Woodford | last post by:
Hi, I have an array of object Anag containing a string and a list of other strings (anagram dictionary). That is, some records in the array may only have two fields (anagram and the one word that matches it), where as others may have three or more (i.e. elmno, melon, lemon). Is there any way to sort this array alphabetically by the first field? Arrays.sort only seems to work for arrays of strings...
1
8740
by: PT | last post by:
I got a problem. And thats..... First of all, I got these three tables. ------------------- ------------------ ---------------------- tblPerson tblPersonSoftware tblSoftware ------------------- ------------------ ---------------------- PID PName PID* SID* SID SWName --- ----- --- --- --- ------ 1 Thomas 1 1 ...
4
30438
by: Andrew | last post by:
Hello, I am recieving a multiple definition error from the linker when I try to build a project I am working on. The message states that the functions I defined within an external .c source file are already defined in the main program .obj file. I declared the functions in seperate header files and used the pre-processor conditional #ifndef FILE_H to make sure each header is only included once. Each .c source file includes the...
5
2235
by: vj | last post by:
Hi all, I am using C++Builder-5. I want to run multiple cpp files at the same time. If I use the C++Builder for running a cpp file (i.e., I just double click the cpp file, it then opens in the C++Builder, where I have the option to 'Run' it), I can't run multiple files, since the Run option is grayed out if one cpp file is already running. I have another option of running the multiple files: from the command prompt (i.e. opening a...
16
3605
by: Rehceb Rotkiv | last post by:
Hello everyone, can I sort a multidimensional array in Python by multiple sort keys? A litte code sample would be nice! Thx, Rehceb
1
2120
by: clickncook | last post by:
I'm currently working on a website for recipes that allows users to search by ingredients they have and I'm experiencing a problem with my filtering. My site allows users to just check the checkboxes of ingredients they have. I've been in and out of every forum I can find on the internet any solution and this forum has been pretty helpful! I'm using PostNuke for my CMS & the bulk of my program is run through Pagesetter. I can get my simple...
0
3109
by: TechnoAtif | last post by:
<?php include "dbconnect.php"; include "commonFunc.php"; ?> <!----------------------------------> <table width="80%" border="1" cellpadding="2" cellspacing="0"> <tr > <td colspan="2"><p>
2
3158
by: beargrease | last post by:
I'm kind of comfortable with basic joins, but a current project requires a complex query of many tables. The GROUP_CONCAT(DISTINCT ...) function has been very useful as returning my values as comma delimited values when joining multiple tables. I have one table called 'floorplans' which has two fields (floorplan_jpg & floorplan_pdf), I'd like each of these fields to return arrays of the same length (they have the same # of values in the data...
0
8547
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8970
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8810
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6462
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5822
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4329
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4564
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2984
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2242
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.