473,775 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating Multiple Record Update Forms

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 all their employee records at
once, and they need to do it quickly, so they can't wait to load one
employee at a time.

So they would see something like this:

Clock Date Hours OT Absent
123 7/7/04 8 0 0
456 7/7/04 9 1 0
789 7/7/04 5 0 3
987 7/7/04 0 0 8

They would be able to update the Hours, OT, and Absent fields, and they
should be able to insert records.

I can figure out how to do a single record update form (like the one you get
with the Update Form wizard in Dreamweaver), but not a multiple record
update form. That is just not practical.

I think I can make each row a form and put an update button at the end. I've
seen this done on some web sites and that might work, but it could still be
too slow. What I would like to do is have one update button at the end of
the form that would send all the records back to the server (or maybe just
those that were changed). Does anyone know if this is possible and have any
pointers on how it is done? Even directions to a good web resource for this,
or a book would be appreciated.

Thanks,
Rob

Jul 17 '05 #1
5 5213
I noticed that Message-ID: <BD************ *********@yahoo .com> from R
Duncan contained the following:
What I would like to do is have one update button at the end of
the form that would send all the records back to the server (or maybe just
those that were changed). Does anyone know if this is possible and have any
pointers on how it is done? Even directions to a good web resource for this,
or a book would be appreciated.


Include the record id as a hidden field.
<input type="hidden" name="id[]" value="id from database">

Make the fields you want to update into arrays. e.g. <input
type="textbox" name="hours_wor ked[]"value=" Hours_worked from database>

for($i=0;$i<cou nt($_POST["id"]);$i++){
$hw=$_POST["hours_work ed"][$i];
$id=$_POST["id"][$i]
$pdate=mysql_qu ery("UPDATE table SET hours_worked='$ hw'
WHERE id=$id");
}

add more fields to same loop as necessary

Apparently there is no problem updating all records since MySql will
ignore those that haven't changed.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
"Geoff Berrow" <bl******@ckdog .co.uk> wrote in message
news:hl******** *************** *********@4ax.c om...
I noticed that Message-ID: <BD************ *********@yahoo .com> from R
Duncan contained the following:
What I would like to do is have one update button at the end of
the form that would send all the records back to the server (or maybe justthose that were changed). Does anyone know if this is possible and have anypointers on how it is done? Even directions to a good web resource for this,or a book would be appreciated.


Include the record id as a hidden field.
<input type="hidden" name="id[]" value="id from database">

Make the fields you want to update into arrays. e.g. <input
type="textbox" name="hours_wor ked[]"value=" Hours_worked from database>


Not a good idea for the simple reason you can't guarentee that the browser
will return hours_worked[] in the same order as id[].

For each field on row embed the row id in the field name

<input type="text" name="hourswork ed_$id" value="$hourswo rked">

foreach($_POST AS $k => $v)
{
/*
check for each field in the row by writing a reg expr
*/
if(preg_match(" ^hoursworked_" , $k))
{
list($ignore , $id) = split("_" , $k)
{
$aPayroll[$id][HOURS_WORKED] = $v;
}
}
}

Jul 17 '05 #3
I noticed that Message-ID: <cc**********@s lavica.ukpost.c om> from CJ
Llewellyn contained the following:
Include the record id as a hidden field.
<input type="hidden" name="id[]" value="id from database">

Make the fields you want to update into arrays. e.g. <input
type="textbox" name="hours_wor ked[]"value=" Hours_worked from database>


Not a good idea for the simple reason you can't guarentee that the browser
will return hours_worked[] in the same order as id[].


In which case you could simply use a counter (hours_worked[$i] id[$]) to
make sure.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #4
"Geoff Berrow" <bl******@ckdog .co.uk> wrote in message
news:ou******** *************** *********@4ax.c om...
I noticed that Message-ID: <cc**********@s lavica.ukpost.c om> from CJ
Llewellyn contained the following:
Include the record id as a hidden field.
<input type="hidden" name="id[]" value="id from database">

Make the fields you want to update into arrays. e.g. <input
type="textbox" name="hours_wor ked[]"value=" Hours_worked from database>


Not a good idea for the simple reason you can't guarentee that the browserwill return hours_worked[] in the same order as id[].


In which case you could simply use a counter (hours_worked[$i] id[$]) to
make sure.


How would you know the start and end points?

You could query the payroll table to see what rows should have been returned
by the form.

Better still, store them in a session array.


Jul 17 '05 #5
I noticed that Message-ID: <cc**********@s lavica.ukpost.c om> from CJ
Llewellyn contained the following:
In which case you could simply use a counter (hours_worked[$i] id[$]) to
make sure.


How would you know the start and end points?


Well I'd like to leave the OP something to do, but I was thinking
something like this:-

$i=0
while($myrow=$m ysql_fetch_arra y($result)){

print "<input
type=\"textbox\ "name=\"hours_w orked[$i]\"value=\"".$my row['hours_worked']."\">";
print"<input type=\"hidden\" name=\"id[$i]\"
value=\"".$myro w['row_id']."\">";
$i++
}

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #6

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

Similar topics

1
9906
by: Matthew Clubb | last post by:
Hi, I need help developing an expanding form I've decided that a use of PHP, Mysql and Javascript is the best platform for creating a selection of database interfaces which I'm trying to build for my company. I had been using Microsoft Access, but obviously this requires licenses for every machine. BUT..... I'm look for an easy way of recreating subforms. I'm trying to create a Purchase Order system and in Access I did this by using a...
2
5972
by: Iain Miller | last post by:
Now this shouldn't be hard but I've been struggling on the best way as to how to do this one for a day or 3 so I thought I'd ask the assembled company..... I'm writing an application that tracks a group of Sales people, the customers they deal with and the business they transact with them. I've got my head around all the tables & some of the basic Query structures OK and am beginning to delve into creating the forms I need to be able...
11
4533
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my database,just help in getting me pointed in the right direction. I have a database with 8 tables, which from what I have read, cannot be linked on a single form, and be updatable. I have created a query which includes all 8 tables, and then...
6
7643
by: F-13 | last post by:
I'm working on a BOM in Access 200 from an example downloaded from from the web. The sample database contains three tables, Assemblies (the list of items needed to assemble any assembly), Components (the list of items recognised by the Assemblies Table)and Output (a table used to display the BOM from a chosen assembly). It works fine but there are no forms. For a user to edit or create a BOM, should there be a form for each assembly of...
10
1956
by: Marc R. | last post by:
Hi all, I edit records using a form that have multiple control bind on Dataview, But I don't want to update right always to database, I would like to delay until all Changes (add all new record using a form or edit various existing records) This way I could minimize transaction on server..
3
3545
by: jpr | last post by:
Hello, I know that this is not the rule but need some help. My datbase has three tables: MASTER TEMPLATES FORMS I have a form which is based on a table named MASTER. I have a primary key set to autonumber and a field SSN which I would
7
3537
by: bcap | last post by:
hi, I am trying to create a form where you may have more than one person at a meeting, but want to have them be related to the same meeting. I have a mulitple select text area and if you select more than one, all the records are being added to the same row. so if I picked the following three people: (Person ID/Desc)
0
2044
by: emalcolm_FLA | last post by:
Hello and TIA for any help with this non profit Christmas assistance project. I have an applicant (app history) and child (child history) tables (4 total). I need to grab the next available (in house case number, appt date and time) for the applicants yearly history and the childs yearly history and then print a report with the applicants info and this in house case number. The forms are linked with ID_app (from the applicant table).
1
1694
by: isoquin | last post by:
Hello- I have one form frmProject1 (record source tblProject1), with two subforms within it: 1) frmPayroll (tblPayroll), and 2) frmTimes (tblTimes) Basically, there are multiple different tblProject(n) where n is some number. While the details of each is stored via their respective forms, all of the forms need to link to tblPayroll and record higher-level information (employee, amount of time, etc). So far, this hasn't been a problem....
0
9621
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10106
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...
1
10046
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
8939
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
7463
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
5358
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
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4014
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
2852
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.