Jump to content

dbdavis55

New Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by dbdavis55

  1. Here is my assignment: 

     

    I just need help with creating this application. Please can you help me. 

     

     

     

    The goal of this program is to create a CRUD application for the MySQL database table recipe with this definition:

    id int auto_increment primary key not null,
    title varchar(255) unique not null,
    description text not null
    The title field is a simple one-line designation and the description represents the instructions in HTML format. The SQL type text, used for the recipe's description, is meant to be used for general, multi-line text content. Program SetupWithin your roadrunner public_html directory, the following directory has already been created.prog4Log in to your account via a secure-shell client.
    1. Install the database initialization file include/db.php. The easiest thing to do is to copy/paste it from things, either through Dreamweaver, or from the shell:$ cd public_html
      $ cp things/include/db.php prog4/include/
      Lastly you can create it from scratch as:
      include/db.php
      <?php
      require_once "rb.php";
       
      $db = "dd750782";
      $user = "dd750782";
      $pass = "dd750782";
      $url = "mysql:host=localhost;dbname=$db";
       
      R::setup( $url, $user, $pass );
      R::freeze( true );select
    2. Run the database setup script:$ cd ~/public_html/prog4 
      $ php setup/make_recipes.php
    3. Edit validate.php and modify the password to a value you want.
    As you develop this application, run the make_recipes.php script whenever you want to reset the database.

     

    Activate the program URL:

     

     

    There are three scripts to complete for the assignment which are described below:index.php
    add.php
    modify.php
    Some general points are:
    1. Forms whose actions add, modify, or delete records must use the POST method; modify is likely to fail if you use the GET method!
    2. Avoid notices without weakening the error_reporting status.
    3. All reentrant activations should have sticky form fields.
    4. Other than choice of colors, make your the presentations be as indicated by the screen shots below. Visual effects should be made, whenever possible, using style rules. In particular, use width and height style properties to control the sizes of textfields and textareas.
    5. The intention of this program is that it be "responsive" in the sense that fields can scale down as the browser width changes. Make good use of percentages for widths.
    Select a recipe: index.phpThe home link (when logged in) should present a selection list of recipe titles like this (with the drop-down is activated):
    a.jpg?1382812844
    On pressing the Show It button, the selected recipe is displayed. The description presentation should be visually distinguished. The Modify/Removebutton should appear, as indicated, only when a selection is made.
    b.jpg?1382811066
    Add a recipe: add.phpThe subfolderrecipe_samples
    contains one recipe, Easy_Meatloaf.txt, that you can use for testing. Download it (e.g., WinSCP) to your client, open it (e.g. NotePad++) and add it with a variety of titles. TextareaThe add form indicated below consists of a textfield for the title and a textarea for the description. The textarea code within the form should look something like this:
    <textarea name="description" spellcheck="off"><?php echo ... ?></textarea>
    Points to note about this usage are:
    • there should be no superfluous white space characters (newlines or otherwise) between the start and end textarea tags
    • the spellcheck="off" attribute setting is useful to avoid having the HTML-based content flagged (I know of no way to achieve this effect through style properties)
    In modern browsers textarea elements are resizable, meaning that you may want to set the max-width and/or min/max-height style properties. UsageChoosing the Add menu link activates add.php which initially presents an empty form for adding a new recipe:
    c.jpg?1382812159
    Pressing the Add button makes a reentrant call to add.php attempting to add a new recipe. If successful, redirect to the home page with the newly created recipe selected and shown. Two possible entry errors have to do with the title:
    • It must have at least 3 characters (when trimmed).
    • It must be unique among recipe titles.
    The entry fields must be sticky to support error handling. If either of these errors occur, display an error response. For example, suppose we start typing "my favorite recipe" like this but press the Add button submit prematurely:
    d.jpg?1382812159
    We continue and "complete" our recipe, setting:title: my favorite recipe
    description: I don't have to write it now
    Submit it, redirecting to show the result:
    f.jpg?1382811066
    Modify/Remove a recipe: modify.phpPressing the Modify/Remove button when a recipe is presented activates modify.php. We want both the title and the description to be modifiable. The contents are loaded into form similar to that used in add:
    g.jpg?1382812159
    RemovePressing the Remove button effects a removal of the recipe. Activation of removal should be protected by user confirmation as done in the thingsapplication. If confirmed, delete the recipe and redirect to the home page (with nothing selected). ModifyPressing the Modify button should effect changes to the fields. The behavior is basically the same as for add; in particular, although they are less likely to occur in practice, these could happen, causing an error:
    1. the user could attempt to reduce the title length to under 3 characters
    2. the user could attempt to change the title to that of another recipe
    Upon success, we redirect to show the result as in adding. For example, suppose I decide to "simplify" the above selected recipe by making these changes before pressing the Modify button:
    h.jpg?1382812481
    After pressing the Modify button, I get this:
    i.jpg?1382811066

     

     
  2. I have a drop down menu with items and my buttons set up. I need help when clicking on the items in the list to show the total to the total box. Here is what I have so far:

    stdClass Object ( )Log out

    Takeout Orders Start Over Items: Nachos  Buffalo Wings  Egg Rolls  Tostada Chips  Chicken Fajita Salad  Spinach Salad  Chicken Caesar Salad  Margarita Grilled Chicken  Margarita Grilled Tuna  Grilled Pork Chops  Bacon Burger  OldTimer Burger  Mushroom-Swiss Burger    

      

     

    Your Order Item Price qty Order Total: $0.00

     

     

     

    <?php
    require_once "include/Session.php";
    $session = new Session();
    if (!isset($session->valid)) {
      require_once "login.php";
      exit();
    }
    require_once "include/menu.php";
     
    /* DO NOT MODIFY THE ABOVE LINES !!!!! */
     
    $params = (object) $_REQUEST;
    print_r($params);
     
    /* Remaining Php handler code goes here  */
     
     
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title>Takeout Orders</title>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title>Takeout Orders</title>
    <style type="text/css">
    body {
      padding: 20px;
    }
    #logout {
      position: absolute;
      top: 40px;
      right: 40px;
      
      #items {
      width:250px;
      height: auto;
      padding:25px;
      border:10px black;
      margin:20px; 
    }
     
    #order {
      width:250px;
      height:auto;
      padding:25px;
      border:10px black;
      margin:20px; 
     }
     
    #items_list {
      width:150px;
      height:auto;
      padding:20px;
      border:30px red;
      margin:auto; 
     }
    }
     
     
    </style>
    </head>
    <body>
    <a id="logout" href="logout.php">Log out</a>
     
     
     
    <h2>Takeout Orders</h2>
     
    <form action="program.php" method="get">
      <button type="submit">Start Over</button>
    </form>
     
    <form action="program.php">
    Items:<select name="menu_item">
     
    <option>Nachos </option>
     
    <option>Buffalo Wings </option>
     
    <option>Egg Rolls </option>
     
    <option>Tostada Chips </option>
     
    <option>Chicken Fajita Salad </option>
     
    <option>Spinach Salad </option>
     
    <option>Chicken Caesar Salad </option>
     
    <option>Margarita Grilled Chicken </option>
     
    <option>Margarita Grilled Tuna </option>
     
    <option>Grilled Pork Chops </option>
     
    <option>Bacon Burger </option>
     
    <option>OldTimer Burger </option>
     
    <option>Mushroom-Swiss Burger </option>
     
    </select>
    <br />
    <br />
    <input type="submit" name="add" value="Add One" />
    <input type="submit" name="remove" value="Remove All of Selected" />
    </form>
    <br />
     
    <div id="order">   
    <h3>Your Order</h3>
    <table width="250" height="55" id="items_table">
    <tr>
    <th>Item</th>
    <th>Price</th>
    <th>qty</th>
    </tr>
     
    <tr><td><strong>Order Total: $0.00</strong></td></tr>
    </table>
    </div>
     
     
    <!-- Add form and presentation code -->
     
    </body>
    </html>
     
     
    I need to do this still:
     
    DescriptionThe goal of this program is to create a simplistic web page for creating a takeout order, which is a list of food items, their individual prices and the quantity of each. A total price is also computed. These snapshots (using Firefox on Mac OSX) represent a sample run.

     

    Upon initial entry or activating he Start Over button the current selections are cleared. Here is the opening page and depiction of the drop-down menu when activated. a.jpg?1394070783a1.png?1393874611

    The user chooses "Egg Rolls" and presses the Add one button twice:

    b.jpg?1394070783

    One "Bacon Burger" and three "Chicken Fajita Salad" additions later:

    c.jpg?1394070783

    The user chooses "Egg Rolls" and presses the Remove all of selected button:

    d.jpg?1394070784
×
×
  • 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.