创建发票(php)

i'm creating ERP system to work with my pharmacy. in the billing form of that system i want to add items and print a bill. i have a little problem, where could i hold my 1st items information while i'm adding a second item to it.. my billing form is like this ( only a dummy)

<table width="490" height="282" border="0">
    <tr>
      <td width="206">Date</td>
      <td width="160">&nbsp;</td>
      <td width="47">&nbsp;</td>
      <td width="69">&nbsp;</td>
    </tr>
    <tr>
      <td>Bill Number</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>Item Code</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>Item Name</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>Expier Date</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>Item Price</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>Each</td>
      <td>Total</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="adnother" id="adnother" value="add another item" tabindex="5" /></td>
      <td><input type="submit" name="submit" id="submit" value="Submit" /></td>
      <td>&nbsp;</td>
    </tr>
  </table>

while adding items to this form one by one, i want those items to be shown in a separate window on the same page (printable version of the bill) any way i can do it. the big problem i have is the thing that i said earlier. {sorry for my bad english :P }

You can store in a session, or in a database, or any other mechanism PHP offers to persist data between requests. See PHP manual for sessions.

Regarding window - you can simply have one page, show the table, and have the form open in other browser window, using JavaScript's window.open(...) method.

You will probably want to refresh the bill window when the adding window is submitted - see window.onclose() and window.refresh()

How about managing the invoices in the DataBase as you build it up?

This way you could review all past invoices. It would also allow you to save incomplete invoices for later if that is a need.

Your problem is similar to shopping cart problem and Most php systems manage it by storing it in sessions with an option to save it in database.

i think best way to do this is using multidimensional arrays to create session. now i'm working on it. will see.. thank you all for your valuable comments HATS OFF to u guys