Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Oct 2012
    Posts
    29
    Thanks
    10
    Thanked 0 Times in 0 Posts

    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!

  • #2
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    721
    Thanks
    20
    Thanked 84 Times in 84 Posts
    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.
    Get Cloud Hosting now from only£59 / month

  • #3
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,456
    Thanks
    8
    Thanked 1,084 Times in 1,075 Posts
    Does the client need to register and log in before filling out the form?

    And what exactly is the form?

  • #4
    New Coder
    Join Date
    Oct 2012
    Posts
    29
    Thanks
    10
    Thanked 0 Times in 0 Posts
    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

  • #5
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    721
    Thanks
    20
    Thanked 84 Times in 84 Posts
    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.
    Get Cloud Hosting now from only£59 / month

  • Users who have thanked Arcticwarrio for this post:

    hujan (03-07-2013)

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,456
    Thanks
    8
    Thanked 1,084 Times in 1,075 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •