www.webdeveloper.com
Results 1 to 6 of 6

Thread: Multiple item entry with edit and delete option

  1. #1
    Join Date
    Jul 2013
    Posts
    7

    Multiple item entry with edit and delete option

    Help me with code for sales order in which one can add multiple item and can store it in database. Example.

    -------------------------------------------------------------------------------------------
    item name | item rate | item quantity| total amount|
    LEd 2100 2 4200 |Edit|Delete (line 1)
    Mouse 100 4 400 |Edit|Delete (line 2)
    Item list | auto fill | manual | Auto fill | Add (line 3)


    Grand Total | 4400 |

    **Submit**
    Item list is taken from databse. item rate should be come auto as specified in database and total amount should come automatically. after pressing add button next line come automatically as line 3 and the added line must look like line 1 and line 2 with edit and delete option. after submitting the form all entry inserted into database.

    Help will be highly appreciated.

  2. #2
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    554
    No code?

  3. #3
    Join Date
    Jul 2013
    Posts
    7
    the work I have done is
    fee.php



    <title>Fee</title>
    <style type="text/css">
    <!--
    body {
    background-image: url(images/background4.jpg);
    }
    body,td,th {
    font-size: 18px;
    }
    -->
    </style>
    <style type="text/css">
    <!--
    h2 {
    font-size: 36px;
    }
    h3 {
    font-size: 36px;
    }
    a:link {
    color: #CCC;
    }
    -->
    </style>
    <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
    </head>

    <link href="/Styles/MainStyle.css" rel="stylesheet" type="text/css">
    <link href="/Styles/PrintStyle.css" rel=" stylesheet"
    type="text/css" media="print">
    <style type="text/css" media="print">
    .NonPrintable
    {
    display: none;
    } </style>

    <body><center>
    </center>
    <form method="post" action="checkfee.php">
    <center>
    <table width="954" height="265" border="0">
    <tr bgcolor="#00CCCC">
    <td width="948" height="261" bgcolor="#CCCCCC"><table width="947" height="90" >
    <tr>
    <td width="939" height="84"><center><h1>&nbsp;</h1>
    </center></td>
    </tr>
    </table><center>
    <table width="941">
    <tr>
    <td width="81">&nbsp;</td>
    <td width="723"><strong><center>
    Fee
    </center></strong></td>
    <td width="121">Rs.
    <?php
    $host="localhost";
    $username="root";
    $password="";
    $database="maggot";
    mysql_connect($host,$username,$password);
    mysql_select_db("$database");
    $query = mysql_query("SELECT MAX(rate) FROM `billing_type`
    WHERE department='Fee'");
    $results = mysql_fetch_array($query);
    $cur_auto_id = $results['MAX(rate)'] ;
    echo $cur_auto_id;
    //echo" <input type='text' name='recieved_in_words' value='$cur_auto_id' />";

    ?>
    only</td>
    </tr>
    </table>
    </center>
    <table width="948" height="30" >
    <tr>
    <td width="223" height="24" align="left">
    <label>Bill No :
    <?php
    $host="localhost";
    $username="root";
    $password="";
    $database="maggot";

    mysql_connect($host,$username,$password);

    mysql_select_db("$database");

    $query = mysql_query("SELECT MAX(bill) FROM `arv`
    WHERE department='Fee'");
    $results = mysql_fetch_array($query);
    $cur_auto_id = $results['MAX(bill)'] + 1;
    echo $cur_auto_id;

    ?>

    </label>
    </td>
    <td width="492"><strong><center>Cash Reciept</center> </strong></td>
    <td width="217" align="right">
    <label>Date :
    <?php
    echo date("Y/m/d");
    ?>
    </label>
    </td>
    </tr>
    </table>
    <center>
    </center>
    <table width="950" height="30">
    <tr>
    <td width="377" height="24" align="left">
    <label>Item Name :<span id="sprytextfield1">
    <input type="text" name="itemname" id="text1" />
    <span class="textfieldRequiredMsg">A value is required.</span></span></label>
    </td>
    <td width="353" align="left">
    <label>rate :<span id="sprytextfield2">
    <input type="text" name="rate" id="text2" />
    <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></label>
    </td>
    <td width="204" align="right">
    <label>quantity :<span id="sprytextfield3">
    <input type="text" name="quantity" id="text3" />
    <span class="textfieldRequiredMsg">A value is required.</span></span></label>
    </td>
    </tr>
    </table>
    <table width="950" height="28" >
    <tr>
    <td width="251" align="left">
    <label>total :<span id="sprytextfield4">
    <input type="text" name="total" id="text4" />
    <span class="textfieldRequiredMsg">A value is required.</span></span></label>
    </td>
    <td width="687" align="left">
    <label>grand total :<span id="sprytextfield5">
    <input type="text" name="grandtotal" id="text5" />
    <span class="textfieldRequiredMsg">A value is required.</span></span></label>
    </td>
    </tr>
    </table>

    <table width="950" height="30">
    <tr>
    <td width="259" height="24"><p>Signature of .................................</p></td>
    <td width="480">&nbsp;</td>
    <td width="195"><p>Signature of...................</p></td>
    </tr>
    </table>
    <table width="945" border="0">
    <tr>
    <td width="468"><label>
    <center><input type="submit" name="button" id="button" value="Submit" class="NonPrintable"/>
    </center></label></td>
    <td width="467"><center></center></td>
    </tr>
    </table></td>
    </tr>
    </table>
    </center></form>
    <script type="text/javascript">
    <!--
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "integer");
    var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
    var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4");
    var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");
    //-->
    </script>
    </body>
    </html>

    checkfee.php


    <title>fee</title>
    <style type="text/css">
    <!--
    body {
    background-image: url(images/background4.jpg);
    }
    body,td,th {
    font-size: 18px;
    }
    -->
    </style>
    <style type="text/css">
    <!--
    h2 {
    font-size: 36px;
    }
    h3 {
    font-size: 36px;
    }
    a:link {
    color: #CCC;
    }
    -->
    </style></head>

    <link href="/Styles/MainStyle.css" rel="stylesheet" type="text/css">
    <link href="/Styles/PrintStyle.css" rel=" stylesheet"
    type="text/css" media="print">
    <style type="text/css" media="print">
    .NonPrintable
    {
    display: none;
    } </style>

    <body><center>
    </center>
    <form method="post" action="">
    <center>
    <table width="954" height="265" border="0">
    <tr bgcolor="#00CCCC">
    <td width="948" height="261" bgcolor="#CCCCCC"><table width="947" height="90" >
    <tr>
    <td width="939" height="84"><center><h1>&nbsp;</h1>
    </center></td>
    </tr>
    </table><center>
    <table width="941">
    <tr>
    <td width="81">&nbsp;</td>
    <td width="766"><strong><center>

    Fee
    </center></strong></td>
    <td width="78">Rs. <?php
    $host="localhost";
    $username="root";
    $password="";
    $database="maggot";
    mysql_connect($host,$username,$password);
    mysql_select_db("$database");
    $query = mysql_query("SELECT MAX(rate) FROM `billing_type`
    WHERE department='Fee'");
    $results = mysql_fetch_array($query);
    $cur_auto_id = $results['MAX(rate)'] ;
    echo $cur_auto_id;
    //echo" <input type='text' name='recieved_in_words' value='$cur_auto_id' />";

    ?> only</td>
    </tr>
    </table>
    </center>
    <table width="948" height="30" >
    <tr>
    <td width="223" height="24" align="left">
    <label>Bill No :
    <?php
    $host="localhost";
    $username="root";
    $password="";
    $database="maggot";

    mysql_connect($host,$username,$password);

    mysql_select_db("$database");
    $department=$_POST['item'];


    $query = mysql_query("SELECT MAX(bill_no) FROM `arv` ");
    $results = mysql_fetch_array($query);
    $cur_auto_id = $results['MAX(bill_no)'] + 1;
    echo $cur_auto_id;

    ?>

    </label>
    </td>
    <td width="492"><strong><center>Cash Reciept</center> </strong></td>
    <td width="217" align="right">
    <label>Date :
    <?php
    echo date("Y/m/d");
    ?>
    </label>
    </td>
    </tr>
    </table>
    <center>
    </center>
    <table width="950" height="30">
    <tr>
    <td width="435" height="24" align="left">
    <label>Name :
    <?php

    print $_POST['itemname'];

    ?>
    </label>
    </td>
    <td width="295" align="left">
    <label>Age :
    <?php

    print $_POST['rate'];

    ?>
    </label>
    </td>
    <td width="204" align="right">
    <label>Sex :
    <?php

    print $_POST['quantity'];

    ?>
    </label>
    </td>
    </tr>
    </table>
    <table width="950" height="28" >
    <tr>
    <td width="435" align="left">
    <label>Ward :
    <?php

    print $_POST['total'];

    ?>
    </label>
    </td>
    <td width="503" align="left">
    <label>Bed No. :
    <?php

    print $_POST['grandtotal'];

    ?>
    </label>
    </td>
    </tr>
    </table>

    <table width="950" height="30">
    <tr>
    <td width="259" height="24"><p>Signature of .................................</p></td>
    <td width="480">&nbsp;</td>
    <td width="195"><p>Signature of...................</p></td>
    </tr>
    </table>
    <table width="945" border="0">
    <tr>
    <td width="468"><label>
    <center>
    </center></label></td>
    <td width="467"><center><input type="submit" name="button2" id="button2" value="Print" onclick="window.print();return false;" class="NonPrintable"/></center></td>
    </tr>
    </table></td>
    </tr>
    </table>
    </center></form>
    </body>
    </html>






    <?php
    require_once ('../connections/connection.php');


    $bill_no=$_POST['bill_no'];
    $date=date('Y/m/d');
    $name=$_POST['itemname'];
    $rate=$_POST['rate'];
    $total=$_POST['total'];
    $grandtotal=$_POST['grandtotal'];
    $quantity=$_POST['quantity'];


    $sql1="INSERT INTO arv ( user, bill, date, itemname, rate, quantity, total, grandtotal)

    VALUES ('$sname', '$bill_no', '$date', '$itemname', '$rate', '$quantity', '$total', '$grandtotal' )";

    mysql_query($sql1);


    echo "Form Submitted";

    ?>

  4. #4
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    554
    The absolute worst attempt at programming I have ever viewed. Your html understanding is so bad, you shouldn't even be worried about php yet.

  5. #5
    Join Date
    Jul 2013
    Posts
    7

    multiple item entry with edit and delete option

    Quote Originally Posted by ginerjm View Post
    The absolute worst attempt at programming I have ever viewed. Your html understanding is so bad, you shouldn't even be worried about php yet.
    can anyone help me for my problem please. I am just trying to do it for my friend's project...........

  6. #6
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    554
    Perhaps your friend should do it himself, since your understanding of html (and apparently php) is pretty limited.

    Start by fixing your html to simply make the page look like you want it. Then encapsulate that into a "DisplayPage" php function and start to build your php code outside of that to effect the desired activities. Grow from there.
    Read a book.
    Search the net.
    It's a learning process - so start teaching yourself.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles