Jump to content

Creating an array from variable variables


natorau

Recommended Posts

Hi Folks,

It's my first post here after a long time of lurking and reading through the forums for help.  Usually i can figure my way out of the issue i am having, but this one has had me beat for about 3 days now, so it's time to call on some experts.

 

OK, i have basically i big matrix of checkboxes.

Along the top of the matrix is 23 columns, each with a seperate unique code (0001 - 0023) indicating particular services which our company offers to customers.

 

Down the side, i have a list of employees of each customer, who also have a unique identifier code (8digits).

 

When a customer logs in, the form populates their existing services and selects the relevant checkboxes.

 

I already have a version which creates a variable from each service id, and adds each customer id to a list, but the scope has changed, and i need to be able to output it around the other way, with a list of customer id's, and their corresponding service id's. You can see the link to the old version from the demo below.

 

I think i need an array for this, that uses variable variables? Though any other suggestions would be great.

 

I've up'd a demo here:  http://www.7squares.com/servicesapp/boxes.php

user: test        pass: password

 

Each row has the list of services checkboxes, and these are all named 'custid[]'  where custid is the actual customer id value.

The value of each checkbox is it's corresponding service id code.

 

In the end, i need to output a list in an email similar to this:

 

Michael Westin: Prinicpal Organisation Contact, Workplace Relations

James Smith: Workplace Relations, Product Technician

etc etc.

 

and also write these to a database in some logical and retrievable format.

 

Once i have a list in the format of:

contactid: roleid, roleid, roleid

 

I can simply just go through and replace contactid and role id with their corresponding full value from the database. This shouldn't be an issue.

 

So, anyone got any ideas on how to acheive this?

 

Thanks.

Brett

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.