#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    List Input + Calculation Help


    I'm looking more for a starting point here. I'd like to build a web application using PHP. The application will accept user input, a field for quantity, description, and two different inputs for "prices"

    The user will be able to "add a new row" to this list by clicking a "Add New Row" link or button of some sort, and then at the end hit "Calculate" and a calculation of the totals in the "price" inputs will be calculated.

    Users will also be able to save their list, edit/update their list and print the list after it has been computed.

    I'm more or less looking for advice, I'm thinking of using CodeIgniter as my framework -- but I'm wondering if anyone has any other suggestions? OR where a good place to start might be?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Sep 2006
    Posts
    1,992
    Rep Power
    533
    I've never used CodeIgniter, but I have heard good things about it. I would be interested to hear other options of it.

    If your application is simple (or even complicated), the following framework will work.

    While I am showing tasks such as addRow and calculate creating the page HTML, typically I do not do so, but make these tasks AJAX routines which display some text or JSON. My main page will include JavaScript and take the response and modify the page as necessary.

    PHP Code:
    <?php
        $task
    =(isset($_GET['task']))?trim($_GET['task']):
        ((isset(
    $_POST['task']))?trim($_POST['task']):'display');
        switch(
    $task)
        {
            case 
    'addRow':
                
    //Add row to database
                
    echo(display());
                break;

            case 
    'calculate':
                echo(
    'Display my calculations');
                break;

            default:    
    //display
                
    display();
                break;
        }
        die();

        function 
    display()
        {
            echo(
    'Echo my HTML headers.
            Then use the database to display the number of rows.
            Then display some links such as the following:
            <a href="index.php?task=addRow">Add Row</a>
            <a href="index.php?task=calculate">Calculate</a>        
            '
    );
        }

    ?>
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0
    Interesting... thanks! That does help actually.

IMN logo majestic logo threadwatch logo seochat tools logo