Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-26-2013, 11:51 AM   PM User | #1
hujan
New Coder

 
Join Date: Oct 2012
Posts: 29
Thanks: 10
Thanked 0 Times in 0 Posts
hujan is an unknown quantity at this point
Interactive PHP form

Hi,

I need help on how to do an interactive form using PHP. What i meant by interactive is:
1) when client fill in form
2) manager can view the client's form and give comment/reply
3) lastly supervisor can view the client's form and manager's comment/reply and also can give comment when needed.

Thanks for the help in advance!
hujan is offline   Reply With Quote
Old 02-26-2013, 01:30 PM   PM User | #2
Arcticwarrio
Regular Coder

 
Arcticwarrio's Avatar
 
Join Date: May 2012
Location: UK
Posts: 597
Thanks: 15
Thanked 67 Times in 67 Posts
Arcticwarrio is on a distinguished road
what do you want on the form for the client to fill in?

and how are you determining who is a client, manager or supervisor?
__________________
There are 10 types of people on CodingForums,
Those who understand Binary and those who dont.
Arcticwarrio is offline   Reply With Quote
Old 02-26-2013, 01:32 PM   PM User | #3
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,046
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
Does the client need to register and log in before filling out the form?

And what exactly is the form?
mlseim is offline   Reply With Quote
Old 02-26-2013, 01:56 PM   PM User | #4
hujan
New Coder

 
Join Date: Oct 2012
Posts: 29
Thanks: 10
Thanked 0 Times in 0 Posts
hujan is an unknown quantity at this point
Thanks for the responds ... client, manager and supervisor have to login first. The form is for those client who want to make complain; and manager/supervisor can comment/reply back.

Complaint's form fields (for client) are: message and solution

Complaint's form fields (for manager/supervisor): comment
hujan is offline   Reply With Quote
Old 02-26-2013, 03:59 PM   PM User | #5
Arcticwarrio
Regular Coder

 
Arcticwarrio's Avatar
 
Join Date: May 2012
Location: UK
Posts: 597
Thanks: 15
Thanked 67 Times in 67 Posts
Arcticwarrio is on a distinguished road
They will all need an access level in the database eg 1 for client 2 for manager 4 for supervisor.

then its just a case of checking it when writing the form.

eg

for future scripts you can put these in any of your included files:

PHP Code:
function check_access($x) {
    if ((
strpos($_SESSION['access_level'], $x)) !== false){
        
$allgood true;
    }
    return 
$allgood;
}

function 
breakdown_access($x) {
    
$n ;
    
$allow ='-';
    while ( 
$x ) {
        if ( 
$x == ) {
          
$allow .= $n.'-';
        }
        
$n *= ;
        
$x >>= ;
    }    
    return 
$allow;

and they are used as so:
on the create/edit user forms have 3 checkboxes with these names

Code:
Client : <input name='UserLVL_1' type='checkbox' id='UserLVL_1' value='1' />
Manager : <input name='UserLVL_2' type='checkbox' id='UserLVL_2' value='2' />
Supervisor : <input name='UserLVL_4' type='checkbox' id='UserLVL_4' value='4' />
and add them together when updating / inserting a user/client
PHP Code:
$U_Level = ($_METHOD['UserLVL_1'] + $_METHOD['UserLVL_2'] + $_METHOD['UserLVL_4']); 
when logging in you can break down the stored access level:
PHP Code:
$_SESSION['access_level'] = breakdown_access($row['AccessLevel']); 
on your complaint form page you check the access level like this:

add the access level numbers together from C=1 M=2 S=4
PHP Code:
if (check_access('1') == 1){
//form only clients can see if managers and supervisors can also see it change above to 7
}

if (
check_access('2') == 1){
//manager only comment  form
}

if (
check_access('4') == 1){
//supervisor only comment form
}

if (
check_access('6') == 1){
//manager or supervisor  comment form

__________________
There are 10 types of people on CodingForums,
Those who understand Binary and those who dont.
Arcticwarrio is offline   Reply With Quote
Users who have thanked Arcticwarrio for this post:
hujan (03-07-2013)
Old 02-26-2013, 08:16 PM   PM User | #6
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,046
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
I would look for a free PHP customer "support ticket" script. That's pretty much the same thing as what you're doing.

Or you can pay a small fee, like this one (for $25), but the main work is all done for you.
It would be worth it for a mere $25 ...
http://codecanyon.net/item/tickets/2478843

And then you customize it to make it work for you.




.

Last edited by mlseim; 02-26-2013 at 08:20 PM..
mlseim is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:25 AM.


Advertisement
Log in to turn off these ads.