473,800 Members | 2,696 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 2071
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
5215
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
8128
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
8753
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
30444
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
2237
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
3627
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
2128
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
3125
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
3174
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
10507
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10255
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10036
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...
0
9092
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7582
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
5473
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
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4150
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
3
2948
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.