Use a radio button to select record to edit

Posted on 2007-11-27
Last Modified: 2010-04-25
Hi all

Scenario, 2 people dealing with records, person1 enters record with add screen which updates tab1
person2, deals with the record in table1, when they have done there job, the record is moved into table 2 and archived with a complete flag.

I am sure I could do this with 1 table but I need to do it this way to suit a business need.

so lets say I have 2 tables,

tab1 has fields
init, surname, date(ymmdd)
tab2 has fields
init, surname, date(ymmdd), complete

I already have the page for person1 setup and writing to a sql db.
For person 2, I need 2 screens, 1st one that scans table1 for records, a sort would be nice perhaps by date
Records should be presented as a 1 liner so lets say name only  (Brief) with a radio button next to them so person2 can select with the radio button the record to retrieve, pass the record to a 2nd screen where the whole detail is shown. Whn person2 is happy, they push a button on the screen and the details are moved from table1 to table2.
Any thoughts please, this is mega urgent, but then arnt they always!
Question by:123dec45
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 25

Expert Comment

ID: 20357672
You could always do this in one operation directly within the database.  Something like

 (init, surname, date, complete)
 init, surname, date, @completeValue
  ??? = ???

DELETE FROM tab1 WHERE ??? = ???

The question marks allow you to add your own where clause, as I don't know how you are identifying the records to move.

Second approach would be to use a server-side language.  Show all records from tab1 on the page with a submit button that copies the individual record to the second table, and then delete from tab1.  Which server-side language are you using?

Accepted Solution

mms_master earned 500 total points
ID: 20357762

>"a sort would be nice perhaps by date"
You can sort your results by adding ORDER BY {field} {order}  replacing {field} with the field name and {order} with ASC for ascending order and DESC for descending order

> "with a radio button next to them so person2 can select with the radio button the record to retrieve"
You need to add a field in table 1 called "id", set the type to int, set it as the primary key and set it to auto increment.
Then add same field in table 2, but this time DONT set it to auto increment.
The value of the radio buttons can then be set to the id of the record. The id can then be passed to the next page in order to retrieve the right record.

I've given an example of the SQL queries you can use below (I done them off the top of my head and haven't tested them, if theres any problems or you need more help with them let me know). I couldn't give you the code for displaying the results as I don't know which language your pages are using. (i.e. php, asp etc)
Page 1:
Retrieve details:
SELECT id, surname, date FROM table1 ORDER BY date ASC
Page 2:
Retrieve details:
SELECT * FROM table1 WHERE id = {id passed from page 1}
Copy details to table2:
INSERT INTO table2(id, surname, date) VALUES({id passed from table 1}, {surname passed from table1}, {date passed from table1})
Delete details from table 1:
DELETE FROM table1 WHERE id = {id passed from page 1}

Open in new window


Author Comment

ID: 20357816
Thanks Rouchie
ASP was the plan, the reason i wanted 2 tables was more from a security side, in the real world, table 1 will have limited information, table 2 sensitive info. The auditors I know will be happier if I can lock down table 2 by usernames or groups rather than trying to do it progromaticaly.
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

LVL 25

Expert Comment

ID: 20357871
Create a recordset in DW and list all the names from tab1.  Add a checkbox to each repeat region so that when the page is submitted the receiving page receives a list of check boxes that are checked,

  i.e. "5, 7, 8, 12, 15, 17"

SQL Server can accept this as a stored procedure argument and turn the numbers into a temporary table, which can then very easily be copied over to tab2.  The first job is to create the list of records from tab1.  See how you get on with that and we'll take it from there!

Author Comment

ID: 20360781
Thanks for the ideas, will give both a try and be back in the morning,.

Author Closing Comment

ID: 31411177
Nice... Sorry its taken some time to get back, always firefighting !!Worked like a drema, thanks for your help

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Update 2 tables at the same time 3 469
xml to xml using xslt and php 4 559
Dreamweaver CC + PhoneGap on Windows PC for IOS 1 246
Dreamweaver CS6 with WordPress 9 125
For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question