0
#----------------------------
# Table structure for litorder
#----------------------------
CREATE TABLE `litorder` (
  `id` int(10) NOT NULL auto_increment,
  `name` varchar(50) NOT NULL default '',
  `address` varchar(50) NOT NULL default '',
  `xdate` date NOT NULL default '0000-00-00',
  `ref` varchar(20) NOT NULL default '',
  `code1` varchar(50) NOT NULL default '',
  `code2` varchar(50) NOT NULL default '',
  `code3` varchar(50) NOT NULL default '',
  `code4` varchar(50) NOT NULL default '',
  `code5` varchar(50) NOT NULL default '',
  `code6` varchar(50) NOT NULL default '',
  `code7` varchar(50) NOT NULL default '',
  `code8` varchar(50) NOT NULL default '',
  `code9` varchar(50) NOT NULL default '',
  `code10` varchar(50) NOT NULL default '',
  `code11` varchar(50) character set latin1 collate latin1_bin NOT NULL default '',
  `code12` varchar(50) NOT NULL default '',
  `code13` varchar(50) NOT NULL default '',
  `code14` varchar(50) NOT NULL default '',
  `code15` varchar(50) NOT NULL default '',
  `product1` varchar(100) NOT NULL default '0',
  `product2` varchar(100) NOT NULL default '0',
  `product3` varchar(100) NOT NULL default '0',
  `product4` varchar(100) NOT NULL default '0',
  `product5` varchar(100) NOT NULL default '0',
  `product6` varchar(100) NOT NULL default '0',
  `product7` varchar(100) NOT NULL default '0',
  `product8` varchar(100) NOT NULL default '0',
  `product9` varchar(100) NOT NULL default '0',
  `product10` varchar(100) NOT NULL default '0',
  `product11` varchar(100) NOT NULL default '0',
  `product12` varchar(100) NOT NULL default '0',
  `product13` varchar(100) NOT NULL default '0',
  `product14` varchar(100) NOT NULL default '0',
  `product15` varchar(100) NOT NULL default '0',
  `price1` int(10) NOT NULL default '0',
  `price2` int(10) NOT NULL default '0',
  `price3` int(10) NOT NULL default '0',
  `price4` int(10) NOT NULL default '0',
  `price5` int(10) NOT NULL default '0',
  `price6` int(10) NOT NULL default '0',
  `price7` int(10) NOT NULL default '0',
  `price8` int(10) NOT NULL default '0',
  `price9` int(10) NOT NULL default '0',
  `price10` int(10) NOT NULL default '0',
  `price11` int(10) NOT NULL default '0',
  `price12` int(10) NOT NULL default '0',
  `price13` int(10) NOT NULL default '0',
  `price14` int(10) NOT NULL default '0',
  `price15` int(10) NOT NULL default '0',
  `quantity1` int(10) NOT NULL default '0',
  `quantity2` int(10) NOT NULL default '0',
  `quantity3` int(10) NOT NULL default '0',
  `quantity4` int(10) NOT NULL default '0',
  `quantity5` int(10) NOT NULL default '0',
  `quantity6` int(10) NOT NULL default '0',
  `quantity7` int(10) NOT NULL default '0',
  `quantity8` int(10) NOT NULL default '0',
  `quantity9` int(10) NOT NULL default '0',
  `quantity10` int(10) NOT NULL default '0',
  `quantity11` int(10) NOT NULL default '0',
  `quantity12` int(10) NOT NULL default '0',
  `quantity13` int(10) NOT NULL default '0',
  `quantity14` int(10) NOT NULL default '0',
  `quantity15` int(10) NOT NULL default '0',
  `amount1` int(10) NOT NULL default '0',
  `amount2` int(10) NOT NULL default '0',
  `amount3` int(10) NOT NULL default '0',
  `amount4` int(10) NOT NULL default '0',
  `amount5` int(10) NOT NULL default '0',
  `amount6` int(10) NOT NULL default '0',
  `amount7` int(10) NOT NULL default '0',
  `amount8` int(10) NOT NULL default '0',
  `amount9` int(10) NOT NULL default '0',
  `amount10` int(10) NOT NULL default '0',
  `amount11` int(10) NOT NULL default '0',
  `amount12` int(10) NOT NULL default '0',
  `amount13` int(10) NOT NULL default '0',
  `amount14` int(10) NOT NULL default '0',
  `amount15` int(10) NOT NULL default '0',
  `totalNaira` double(20,0) NOT NULL default '0',
  `totalDollar` int(20) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 4096 kB; InnoDB free: 4096 kB; InnoDB free: 409';
#----------------------------
# Records for table litorder
#----------------------------


insert  into litorder values 
(27, 'Sanyaolu Fisayo', 'SNIPPED', '2010-05-31', '', 'DL 001', 'DL 002', 'DL 003', '', '', '', '', '', '', '', '', '', '', '', '', 'AILMENT & PREVENTION DVD- ENGLISH', 'AILMENT & PREVENTION DVD- HAUSA', 'BEAUTY CD', '', '', '', '', '', '', '', '', '', '', '', '', 800, 800, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12800, 12800, 60000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '85600', 563), 
(28, 'Irenonse Esther', 'Lagos,Nigeria', '2010-06-01', '', 'DL 005', 'DL 008', 'FC 004', '', '', '', '', '', '', '', '', '', '', '', '', 'GET HEALTHY DVD', 'YOUR FUTURE DVD', 'FOREVER FACE CAP (YELLOW)', '', '', '', '', '', '', '', '', '', '', '', '', 1000, 900, 2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2000, 1800, 6000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '9800', 64), 
(29, 'Kalu Lekway', 'Lagos, Nigeria', '2010-06-01', '', 'DL 001', 'DL 003', '', '', '', '', '', '', '', '', '', '', '', '', '', 'AILMENT & PREVENTION DVD- ENGLISH', 'BEAUTY CD', '', '', '', '', '', '', '', '', '', '', '', '', '', 800, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2400, 18000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '20400', 133), 
(30, 'Dele', 'Ilupeju', '2010-06-02', '', 'DL 001', 'DL 003', '', '', '', '', '', '', '', '', '', '', '', '', '', 'AILMENT & PREVENTION DVD- ENGLISH', 'BEAUTY CD', '', '', '', '', '', '', '', '', '', '', '', '', '', 800, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8000, 30000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '38000', 250);

Edited by happygeek: address deleted

3
Contributors
10
Replies
12
Views
7 Years
Discussion Span
Last Post by tyson.crouch
0

WOW.

Before i even TRY to salvage this.. can you please tell me why it is that you have 15 of each items?? With most of which being empty in your table???


I will help you. but please explain why it is that you have made such an utterly horrible DB

Edited by tyson.crouch: n/a

0

WOW, Edgar Frank Codd is about turning in his grave speedily ...

This monster of table does not even fit first normal form because of its horizontally repeating groups (#1... #15). (for such tables you will never be able to construct effective sql select statements. There may also be a sea of anomalies...)

You need to decompose it into several tables where the most important table consist of ONLY ONE attribute set (code, product, price )

If you want to distinguish code #1 from code #15 or even a new code #33 from #99 then simply add sort_of attribute to your table, and you will get (sort_of, code, product, price).

Consider your poor but mysql-typical first solution: How to implement a new code above code15? You need to do changes of table structures, also additional programming tasks is necessary.

-- tesu

0

Let me make a further recommendation:

don't start database design on the create-table level. Start with designing the ERM. For this task you may use the really powerful Mysql Work Bench (v5.1 or so). If you publish an ERM on daniweb it is quite easier to help you.

-- tesu

0

Try this:

--
-- Table structure for table `litorder`
--

CREATE TABLE IF NOT EXISTS `litorder` (
  `order_ID` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Order identification number',
  `order_Name` varchar(45) NOT NULL COMMENT 'Column holds name of person who placed order\n',
  `order_Address` varchar(45) NOT NULL COMMENT 'Holds the address of the indivudal who placed order',
  `order_Date` date NOT NULL COMMENT 'Date of order',
  `order_Reference` varchar(45) NOT NULL,
  `order_Naira` double NOT NULL,
  `order_Dollars` double NOT NULL,
  PRIMARY KEY (`order_ID`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 COMMENT='Table which holds basic order details' AUTO_INCREMENT=2 ;

--
-- Dumping data for table `litorder`
--

INSERT INTO `litorder` (`order_ID`, `order_Name`, `order_Address`, `order_Date`, `order_Reference`, `order_Naira`, `order_Dollars`) VALUES
(1, 'Sanyaolu Fisayo', 'SNIPPED', '2010-05-31', 'DL 001', 85600, 563);

-- --------------------------------------------------------

--
-- Table structure for table `orderdetails`
--

CREATE TABLE IF NOT EXISTS `orderdetails` (
  `detail_ID` int(11) NOT NULL AUTO_INCREMENT,
  `order_ID` int(10) unsigned NOT NULL,
  `item_code` varchar(50) NOT NULL,
  `product` varchar(255) NOT NULL,
  `quantity` int(20) NOT NULL,
  `amount` double(20,2) NOT NULL,
  `price` double(20,2) NOT NULL,
  PRIMARY KEY (`detail_ID`),
  KEY `order_ID` (`order_ID`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Dumping data for table `orderdetails`
--

INSERT INTO `orderdetails` (`detail_ID`, `order_ID`, `item_code`, `product`, `quantity`, `amount`, `price`) VALUES
(1, 1, 'DL 001', 'AILMENT & PREVENTION DVD- ENGLISH', 16, 12800.00, 800.00),
(2, 1, 'DL 002', 'AILMENT & PREVENTION DVD- HAUSA', 16, 12800.00, 800.00),
(4, 1, 'DL 003', 'BEAUTY CD', 60000, 20.00, 3000.00);

--
-- Constraints for table `orderdetails`
--
ALTER TABLE `orderdetails`
  ADD CONSTRAINT `orderdetails_ibfk_1` FOREIGN KEY (`order_ID`) REFERENCES `litorder` (`order_ID`) ON DELETE CASCADE ON UPDATE CASCADE;

Edited by happygeek: address deleted

0

Copy and paste into your SQL CLI or what ever your using, then CAREFULLY look at and try to understand what i have done

0

WOW.

Before i even TRY to salvage this.. can you please tell me why it is that you have 15 of each items?? With most of which being empty in your table???

I will help you. but please explain why it is that you have made such an utterly horrible DB

@tyson.crouch thanks for your time and help. All i wanted is to create a simple invoicing system. I want to be able to process up to 15 products at a time so i created (product1.....product15), (quantity1.....quantity15), (price1.....price15) and (amount1.....amount15). It was horrible!!

Thanks for the code you gave. But how do I build my HTML that transfer all info into the new Normalize DB?

MY OLD HTML IS

<form action="confirmlitOrder.php" method="post" name="sampleform">
		  
		  <table width="90%" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr> 
            <td align="left"><span class="welcomex">To:</span><br>
              <input name="name" type="text" class="inputX" id="name" value="Input Customer Name" size="25" onfocus="this.value=''"/>
              <br/> <br/>
              <textarea name="address" cols="40" rows="4" class="inputX" id="address" onfocus="this.value=''">Input Customer Address</textarea></td></tr>
          <tr align="right" valign="middle"> 
            <td align="right" valign="baseline"> 
			  <strong class="welcomexx">Click To Select Date &raquo;</strong>&nbsp;&nbsp;<a href="javascript:showCal('Calendar1')"><img src="images/calendar.png" width="20" height="19" border="0" /></a>&nbsp;
			  <input type="text" name="firstinput" size=10 class="inputX"> 			  </td>
          </tr>
  
</table>

            <table width="70%" border="1" align="center" CELLPADDING="2" CELLSPACING="0" bordercolor="<?PHP print "$BorderColour"; ?>">
            
			<tr>
              <td class="welcomexx">S/N</td>
              <td class="welcomexx">Code</td>
              <td class="welcomexx">Product Description </td>
              <td class="welcomexx">              Quantity</td>
              <td class="welcomexx">Price</td>
              <td class="welcomexx">Amount</td>
            </tr>
            <tr>
              <td class="welcomexx">1.</td>
              <td><select name="select1" class="inputX" id="select1" onchange="Ajaxifyit('select1')">
                                      <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?> 
                </Select>          </td>
              <td><input name="product1" type="text" class="inputX" id="product1" size="60"/></td>
              <td><input name="qty1" type="text" class="inputX" id="qty1" size="5" onblur="calcAmnt('qty1')" /></td>
              <td><input name="price1" type="text" class="inputX" id="price1" size="10" /></td>
              <td><input name="amt1" type="text" class="inputX" id="amt1" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">2.</td>
              <td><select name="select2" class="inputX" id="select2" onchange="Ajaxifyit('select2')">
                                      <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?> 
              </Select></td>
              <td><input name="product2" type="text" class="inputX" id="product2" size="60"/></td>
              <td><input name="qty2" type="text" class="inputX" id="qty2" size="5" onblur="calcAmnt('qty2')" /></td>
              <td><input name="price2" type="text" class="inputX" id="price2" size="10" /></td>
              <td><input name="amt2" type="text" class="inputX" id="amt2" size="10"  /></td>
            </tr>
            <tr>
              <td class="welcomexx">3</td>
              <td><select name="select3" class="inputX" id="select3" onchange="Ajaxifyit('select3')">
                                      <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?> 
              </Select></td>
              <td><input name="product3" type="text" class="inputX" id="product3" size="60" /></td>
              <td><input name="qty3" type="text" class="inputX" id="qty3" size="5" onblur="calcAmnt('qty3')"/></td>
              <td><input name="price3" type="text" class="inputX" id="price3" size="10" /></td>
              <td><input name="amt3" type="text" class="inputX" id="amt3" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">4</td>
              <td><select name="select4" class="inputX" id="select4" onchange="Ajaxifyit('select4')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product4" type="text" class="inputX" id="product4" size="60" /></td>
              <td><input name="qty4" type="text" class="inputX" id="qty4" size="5" onblur="calcAmnt('qty4')" /></td>
              <td><input name="price4" type="text" class="inputX" id="price4" size="10" /></td>
              <td><input name="amt4" type="text" class="inputX" id="amt4" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">5</td>
              <td><select name="select5" class="inputX" id="select5" onchange="Ajaxifyit('select5')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product5" type="text" class="inputX" id="product5" size="60" /></td>
              <td><input name="qty5" type="text" class="inputX" id="qty5" size="5" onblur="calcAmnt('qty5')"/></td>
              <td><input name="price5" type="text" class="inputX" id="price5" size="10" /></td>
              <td><input name="amt5" type="text" class="inputX" id="amt5" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">6</td>
              <td><select name="select6" class="inputX" id="select6" onchange="Ajaxifyit('select6')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product6" type="text" class="inputX" id="product6" size="60" /></td>
              <td><input name="qty6" type="text" class="inputX" id="qty6" size="5" onblur="calcAmnt('qty6')" /></td>
              <td><input name="price6" type="text" class="inputX" id="price6" size="10" /></td>
              <td><input name="amt6" type="text" class="inputX" id="amt6" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">7</td>
              <td><select name="select7" class="inputX" id="select7" onchange="Ajaxifyit('select7')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product7" type="text" class="inputX" id="product7" size="60" /></td>
              <td><input name="qty7" type="text" class="inputX" id="qty7" size="5" onblur="calcAmnt('qty7')" /></td>
              <td><input name="price7" type="text" class="inputX" id="price7" size="10" /></td>
              <td><input name="amt7" type="text" class="inputX" id="amt7" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">8</td>
              <td><select name="select8" class="inputX" id="select8" onchange="Ajaxifyit('select8')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product8" type="text" class="inputX" id="product8" size="60" /></td>
              <td><input name="qty8" type="text" class="inputX" id="qty8" size="5" onblur="calcAmnt('qty8')"/></td>
              <td><input name="price8" type="text" class="inputX" id="price8" size="10" /></td>
              <td><input name="amt8" type="text" class="inputX" id="amt8" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">9</td>
              <td><select name="select9" class="inputX" id="select9" onchange="Ajaxifyit('select9')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product9" type="text" class="inputX" id="product9" size="60" /></td>
              <td><input name="qty9" type="text" class="inputX" id="qty9" size="5" onblur="calcAmnt('qty9')"/></td>
              <td><input name="price9" type="text" class="inputX" id="price9" size="10" /></td>
              <td><input name="amt9" type="text" class="inputX" id="amt9" size="10" /></td>
            </tr><tr>
           <td class="welcomexx">10</td>
              <td><select name="select10" class="inputX" id="select10" onchange="Ajaxifyit('select10')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product10" type="text" class="inputX" id="product10" size="60" /></td>
              <td><input name="qty10" type="text" class="inputX" id="qty10" size="5" onblur="calcAmnt('qty10')"/></td>
              <td><input name="price10" type="text" class="inputX" id="price10" size="10" /></td>
              <td><input name="amt10" type="text" class="inputX" id="amt10" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">11</td>
              <td><select name="select11" class="inputX" id="select11" onchange="Ajaxifyit('select11')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product11" type="text" class="inputX" id="product11" size="60" /></td>
              <td><input name="qty11" type="text" class="inputX" id="qty11" size="5" onblur="calcAmnt('qty11')"/></td>
              <td><input name="price11" type="text" class="inputX" id="price11" size="10" /></td>
              <td><input name="amt11" type="text" class="inputX" id="amt11" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">12</td>
              <td><select name="select12" class="inputX" id="select12" onchange="Ajaxifyit('select12')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product12" type="text" class="inputX" id="product12" size="60" /></td>
              <td><input name="qty12" type="text" class="inputX" id="qty12" size="5" onblur="calcAmnt('qty12')"/></td>
              <td><input name="price12" type="text" class="inputX" id="price12" size="10" /></td>
              <td><input name="amt12" type="text" class="inputX" id="amt12" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">13</td>
              <td><select name="select13" class="inputX" id="select13" onchange="Ajaxifyit('select13')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product13" type="text" class="inputX" id="product13" size="60" /></td>
              <td><input name="qty13" type="text" class="inputX" id="qty13" size="5" onblur="calcAmnt('qty13')"/></td>
              <td><input name="price13" type="text" class="inputX" id="price13" size="10" /></td>
              <td><input name="amt13" type="text" class="inputX" id="amt13" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">14</td>
              <td><select name="select14" class="inputX" id="select14" onchange="Ajaxifyit('select14')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product14" type="text" class="inputX" id="product14" size="60" /></td>
              <td><input name="qty14" type="text" class="inputX" id="qty14" size="5" onblur="calcAmnt('qty14')"/></td>
              <td><input name="price14" type="text" class="inputX" id="price14" size="10" /></td>
              <td><input name="amt14" type="text" class="inputX" id="amt14" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">15</td>
              <td><select name="select15" class="inputX" id="select15" onchange="Ajaxifyit('select15')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product15" type="text" class="inputX" id="product15" size="60" /></td>
              <td><input name="qty15" type="text" class="inputX" id="qty15" size="5" onblur="calcAmnt('qty15')"/></td>
              <td><input name="price15" type="text" class="inputX" id="price15" size="10" /></td>
              <td><input name="amt15" type="text" class="inputX" id="amt15" size="10" /></td><tr/>

		    <tr>
              <td colspan="6" class="welcomexx"><div align="right">
                <input name="Submit" type="submit" class="goZ" value="&raquo; &raquo; Review Invoice" />
              </div></td>
              </tr>
          </table>
          </form>

Then i confirm

<form action="print_lit_Order.php" method="post" name="sampleform">
		  
		  <table width="90%" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr> 
            <td align="left"><span class="welcomex">To:</span><br>
              <input name="name" type="text" class="inputX" id="name" value="<?php print $name; ?>" size="25" onfocus="this.value=''"/>
              <br>
              <textarea name="address" cols="40" rows="4" class="inputX" id="address" onfocus="this.value=''"><?php print str_replace("\n", "<br>", $address); ?></textarea></td></tr>
          <tr align="right" valign="middle"> 
            <td align="right" valign="baseline"> 
			  <strong class="welcomexx">Click To Select Date &raquo;</strong>&nbsp;&nbsp;<a href="javascript:showCal('Calendar1')"></a>&nbsp;
			  <input name="firstinput" type="text" class="inputX" value="<?php print $date; ?>" size=10> 			  </td>
          </tr>
  
</table>

            <table width="70%" border="1" align="center" CELLPADDING="2" CELLSPACING="0" bordercolor="<?PHP print "$BorderColour"; ?>">
            
			<tr>
              <td class="welcomexx">S/N</td>
              <td class="welcomexx">Code</td>
              <td class="welcomexx">Product Description </td>
              <td class="welcomexx">Quantity</td>
              <td class="welcomexx">Price</td>
              <td class="welcomexx">Amount</td>
            </tr>
            <tr>
              <td class="welcomexx">1.</td>
              <td><input name="select1" type="text" class="inputX" id="select1" value="<?php print $select1; ?>" size="10" /></td>
              <td><input name="product1" type="text" class="inputX" id="product1" value="<?php print $product1; ?>" size="60"/></td>
              <td><input name="qty1" type="text" class="inputX" id="qty1" onblur="calcAmnt('qty1')" value="<?php print $qty1; ?>" size="5" /></td>
              <td><input name="price1" type="text" class="inputX" id="price1" value="<?php print $price1; ?>" size="10" /></td>
              <td><input name="amt1" type="text" class="inputX" id="amt1" value="<?php print $amt1; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">2.</td>
              <td><input name="select2" type="text" class="inputX" id="select2" value="<?php print $select2; ?>" size="10" /></td>
              <td><input name="product2" type="text" class="inputX" id="product2" value="<?php print $product2; ?>" size="60"/></td>
              <td><input name="qty2" type="text" class="inputX" id="qty2" onblur="calcAmnt('qty2')" value="<?php print $qty2; ?>" size="5" /></td>
              <td><input name="price2" type="text" class="inputX" id="price2" value="<?php print $price2; ?>" size="10" /></td>
              <td><input name="amt2" type="text" class="inputX" id="amt2" value="<?php print $amt2; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">3</td>
              <td><input name="select3" type="text" class="inputX" id="select3" value="<?php print $select3; ?>" size="10" /></td>
              <td><input name="product3" type="text" class="inputX" id="product3" value="<?php print $product3; ?>" size="60"/></td>
              <td><input name="qty3" type="text" class="inputX" id="qty3" onblur="calcAmnt('qty3')" value="<?php print $qty3; ?>" size="5" /></td>
              <td><input name="price3" type="text" class="inputX" id="price3" value="<?php print $price3; ?>" size="10" /></td>
              <td><input name="amt3" type="text" class="inputX" id="amt3" value="<?php print $amt3; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">4</td>
              <td><input name="select4" type="text" class="inputX" id="select4" value="<?php print $select4; ?>" size="10" /></td>
              <td><input name="product4" type="text" class="inputX" id="product4" value="<?php print $product4; ?>" size="60"/></td>
              <td><input name="qty4" type="text" class="inputX" id="qty4" onblur="calcAmnt('qty4')" value="<?php print $qty4; ?>" size="5" /></td>
              <td><input name="price4" type="text" class="inputX" id="price4" value="<?php print $price4; ?>" size="10" /></td>
              <td><input name="amt4" type="text" class="inputX" id="amt4" value="<?php print $amt4; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">5</td>
              <td><input name="select5" type="text" class="inputX" id="select5" value="<?php print $select5; ?>" size="10" /></td>
              <td><input name="product5" type="text" class="inputX" id="product5" value="<?php print $product5; ?>" size="60"/></td>
              <td><input name="qty5" type="text" class="inputX" id="qty5" onblur="calcAmnt('qty5')" value="<?php print $qty5; ?>" size="5" /></td>
              <td><input name="price5" type="text" class="inputX" id="price5" value="<?php print $price5; ?>" size="10" /></td>
              <td><input name="amt5" type="text" class="inputX" id="amt5" value="<?php print $amt5; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">6</td>
              <td><input name="select6" type="text" class="inputX" id="select6" value="<?php print $select6; ?>" size="10" /></td>
              <td><input name="product6" type="text" class="inputX" id="product6" value="<?php print $product6; ?>" size="60"/></td>
              <td><input name="qty6" type="text" class="inputX" id="qty6" onblur="calcAmnt('qty6')" value="<?php print $qty6; ?>" size="5" /></td>
              <td><input name="price6" type="text" class="inputX" id="price6" value="<?php print $price6; ?>" size="10" /></td>
              <td><input name="amt6" type="text" class="inputX" id="amt6" value="<?php print $amt6; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">7</td>
              <td><input name="select7" type="text" class="inputX" id="select7" value="<?php print $select7; ?>" size="10" /></td>
              <td><input name="product7" type="text" class="inputX" id="product7" value="<?php print $product7; ?>" size="60"/></td>
              <td><input name="qty7" type="text" class="inputX" id="qty7" onblur="calcAmnt('qty7')" value="<?php print $qty7; ?>" size="5" /></td>
              <td><input name="price7" type="text" class="inputX" id="price7" value="<?php print $price7; ?>" size="10" /></td>
              <td><input name="amt7" type="text" class="inputX" id="amt7" value="<?php print $amt7; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">8</td>
              <td><input name="select8" type="text" class="inputX" id="select8" value="<?php print $select8; ?>" size="10" /></td>
              <td><input name="product8" type="text" class="inputX" id="product8" value="<?php print $product8; ?>" size="60"/></td>
              <td><input name="qty8" type="text" class="inputX" id="qty8" onblur="calcAmnt('qty8')" value="<?php print $qty8; ?>" size="5" /></td>
              <td><input name="price8" type="text" class="inputX" id="price8" value="<?php print $price8; ?>" size="10" /></td>
              <td><input name="amt8" type="text" class="inputX" id="amt8" value="<?php print $amt8; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">9</td>
              <td><input name="select9" type="text" class="inputX" id="select9" value="<?php print $select9; ?>" size="10" /></td>
              <td><input name="product9" type="text" class="inputX" id="product9" value="<?php print $product9; ?>" size="60"/></td>
              <td><input name="qty9" type="text" class="inputX" id="qty9" onblur="calcAmnt('qty9')" value="<?php print $qty9; ?>" size="5" /></td>
              <td><input name="price9" type="text" class="inputX" id="price9" value="<?php print $price9; ?>" size="10" /></td>
              <td><input name="amt9" type="text" class="inputX" id="amt9" value="<?php print $amt9; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">10</td>
              <td><input name="select10" type="text" class="inputX" id="select10" value="<?php print $select10; ?>" size="10" /></td>
              <td><input name="product10" type="text" class="inputX" id="product10" value="<?php print $product10; ?>" size="60"/></td>
              <td><input name="qty10" type="text" class="inputX" id="qty10" onblur="calcAmnt('qty10')" value="<?php print $qty10; ?>" size="5" /></td>
              <td><input name="price10" type="text" class="inputX" id="price10" value="<?php print $price10; ?>" size="10" /></td>
              <td><input name="amt10" type="text" class="inputX" id="amt10" value="<?php print $amt10; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">11</td>
              <td><input name="select11" type="text" class="inputX" id="select11" value="<?php print $select11; ?>" size="10" /></td>
              <td><input name="product11" type="text" class="inputX" id="product11" value="<?php print $product11; ?>" size="60"/></td>
              <td><input name="qty11" type="text" class="inputX" id="qty11" onblur="calcAmnt('qty11')" value="<?php print $qty11; ?>" size="5" /></td>
              <td><input name="price11" type="text" class="inputX" id="price11" value="<?php print $price11; ?>" size="10" /></td>
              <td><input name="amt11" type="text" class="inputX" id="amt11" value="<?php print $amt11; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">12</td>
              <td><input name="select12" type="text" class="inputX" id="select12" value="<?php print $select12; ?>" size="10" /></td>
              <td><input name="product12" type="text" class="inputX" id="product12" value="<?php print $product12; ?>" size="60"/></td>
              <td><input name="qty12" type="text" class="inputX" id="qty12" onblur="calcAmnt('qty12')" value="<?php print $qty12; ?>" size="5" /></td>
              <td><input name="price12" type="text" class="inputX" id="price12" value="<?php print $price12; ?>" size="10" /></td>
              <td><input name="amt12" type="text" class="inputX" id="amt12" value="<?php print $amt12; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">13</td>
              <td><input name="select13" type="text" class="inputX" id="select13" value="<?php print $select13; ?>" size="10" /></td>
              <td><input name="product13" type="text" class="inputX" id="product13" value="<?php print $product13; ?>" size="60"/></td>
              <td><input name="qty13" type="text" class="inputX" id="qty13" onblur="calcAmnt('qty13')" value="<?php print $qty13; ?>" size="5" /></td>
              <td><input name="price13" type="text" class="inputX" id="price13" value="<?php print $price13; ?>" size="10" /></td>
              <td><input name="amt13" type="text" class="inputX" id="amt13" value="<?php print $amt13; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">14</td>
              <td><input name="select14" type="text" class="inputX" id="select14" value="<?php print $select14; ?>" size="10" /></td>
              <td><input name="product14" type="text" class="inputX" id="product14" value="<?php print $product14; ?>" size="60"/></td>
              <td><input name="qty14" type="text" class="inputX" id="qty14" onblur="calcAmnt('qty14')" value="<?php print $qty14; ?>" size="5" /></td>
              <td><input name="price14" type="text" class="inputX" id="price14" value="<?php print $price14; ?>" size="10" /></td>
              <td><input name="amt14" type="text" class="inputX" id="amt14" value="<?php print $amt14; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">15</td>
              <td><input name="select15" type="text" class="inputX" id="select15" value="<?php print $select15; ?>" size="10" /></td>
              <td><input name="product15" type="text" class="inputX" id="product15" value="<?php print $product15; ?>" size="60"/></td>
              <td><input name="qty15" type="text" class="inputX" id="qty15" onblur="calcAmnt('qty15')" value="<?php print $qty15; ?>" size="5" /></td>
              <td><input name="price15" type="text" class="inputX" id="price15" value="<?php print $price15; ?>" size="10" /></td>
              <td><input name="amt15" type="text" class="inputX" id="amt15" value="<?php print $amt15; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td colspan="6" align="right" valign="top" class="welcomexx"><table width="60%" border="0" cellspacing="2" cellpadding="2">
                <tr>
                  <td width="28%" align="right">Total in Naira (<img src="images/naira.jpg" width="9" height="11" />) </td>
                  <td width="16%"><input name="totalNaira" type="text" class="inputX" id="totalNaira" value="<?php print number_format($totalNaira); ?>" size="10" /></td>
                  <td width="34%" align="right">Total in Dollars $</td>
                  <td width="22%"><input name="totalDollar" type="text" class="inputX" id="totalDollar" value="<?php print number_format($totalDollar); ?>" size="10" /></td>
                </tr>
              </table></td>
              </tr>
            <tr>
              <td colspan="5" class="welcomexx"><input name="dollarRate" type="hidden" id="dollarRate" value="<?php echo $rate; ?>" /></td>
              <td class="welcomexx"><input name="Submit" type="submit" class="goZ" value="&raquo; &raquo; Process Invoice" /></td>
            </tr>
          </table>
          </form>

Next is to Print a copy and also send a copy into the DB which i do with

<?php 
//Get Client Details
$name = $_POST['name'];
$address = $_POST['address'];
$date = $_POST['firstinput'];
//Get Codes
$select1 = $_POST['select1'];
$select2 = $_POST['select2'];
$select3 = $_POST['select3'];
$select4 = $_POST['select4'];
$select5 = $_POST['select5'];
$select6 = $_POST['select6'];
$select7 = $_POST['select7'];
$select8 = $_POST['select8'];
$select9 = $_POST['select9'];
$select10 = $_POST['select10'];
$select11 = $_POST['select11'];
$select12 = $_POST['select12'];
$select13 = $_POST['select13'];
$select14 = $_POST['select14'];
$select15 = $_POST['select15'];

//Get Products
$product1 = $_POST['product1'];
$product2 = $_POST['product2'];
$product3 = $_POST['product3'];
$product4 = $_POST['product4'];
$product5 = $_POST['product5'];
$product6 = $_POST['product6'];
$product7 = $_POST['product7'];
$product8 = $_POST['product8'];
$product9 = $_POST['product9'];
$product10 = $_POST['product10'];
$product11 = $_POST['product11'];
$product12 = $_POST['product12'];
$product13 = $_POST['product13'];
$product14 = $_POST['product14'];
$product15 = $_POST['product15'];

//Get Prices
$price1 = $_POST['price1'];
$price2 = $_POST['price2'];
$price3 = $_POST['price3'];
$price4 = $_POST['price4'];
$price5 = $_POST['price5'];
$price6 = $_POST['price6'];
$price7 = $_POST['price7'];
$price8 = $_POST['price8'];
$price9 = $_POST['price9'];
$price10 = $_POST['price10'];
$price11 = $_POST['price11'];
$price12 = $_POST['price12'];
$price13 = $_POST['price13'];
$price14 = $_POST['price14'];
$price15 = $_POST['price15'];

//Get Quantity
$qty1 = $_POST['qty1'];
$qty2 = $_POST['qty2'];
$qty3 = $_POST['qty3'];
$qty4 = $_POST['qty4'];
$qty5 = $_POST['qty5'];
$qty6 = $_POST['qty6'];
$qty7 = $_POST['qty7'];
$qty8 = $_POST['qty8'];
$qty9 = $_POST['qty9'];
$qty10 = $_POST['qty10'];
$qty11 = $_POST['qty11'];
$qty12 = $_POST['qty12'];
$qty13 = $_POST['qty13'];
$qty14 = $_POST['qty14'];
$qty15 = $_POST['qty15'];

//Get Amount
$amt1 = $_POST['amt1'];
$amt2 = $_POST['amt2'];
$amt3 = $_POST['amt3'];
$amt4 = $_POST['amt4'];
$amt5 = $_POST['amt5'];
$amt6 = $_POST['amt6'];
$amt7 = $_POST['amt7'];
$amt8 = $_POST['amt8'];
$amt9 = $_POST['amt9'];
$amt10 = $_POST['amt10'];
$amt11 = $_POST['amt11'];
$amt12 = $_POST['amt12'];
$amt13 = $_POST['amt13'];
$amt14 = $_POST['amt14'];
$amt15 = $_POST['amt15'];
$totalNaira=$amt1+$amt2+$amt3+$amt4+$amt5+$amt6+$amt7+$amt8+$amt9+$amt10+$amt11+$amt12+$amt13+$amt14+$amt15;
$totalDollar=$totalNaira/$rate;
?>

<?php
mysql_select_db($database_tSaturnConn, $tSaturnConn);
$sql="INSERT INTO litorder (name, address, xdate, code1, code2, code3, code4, code5, code6, code7, code8, code9, code10, code11, code12, code13, code14, code15, product1, product2, product3, product4, product5, product6, product7, product8, product9, product10, product11, product12, product13, product14, product15, price1, price2, price3, price4, price5, price6, price7, price8, price9, price10, price11, price12, price13, price14, price15, quantity1, quantity2, quantity3, quantity4, quantity5, quantity6, quantity7, quantity8, quantity9, quantity10, quantity11, quantity12, quantity13, quantity14, quantity15, amount1, amount2, amount3, amount4, amount5, amount6, amount7, amount8, amount9, amount10, amount11, amount12, amount13, amount14, amount15, totalNaira, totalDollar) VALUES ('$name', '$address',  '$date', '$select1', '$select2', '$select3', '$select4', '$select5', '$select6', '$select7', '$select8', '$select9','$select10', '$select11', '$select12', '$select13', '$select14', '$select15', '$product1', '$product2', '$product3', '$product4', '$product5', '$product6', '$product7', '$product8', '$product9','$product10', '$product11', '$product12', '$product13', '$product14', '$product15', '$price1', '$price2', '$price3', '$price4', '$price5', '$price6', '$price7', '$price8', '$price9','$price10', '$price11', '$price12', '$price13', '$price14', '$price15', '$qty1', '$qty2', '$qty3', '$qty4', '$qty5', '$qty6', '$qty7', '$qty8', '$qty9','$qty10', '$qty11', '$qty12', '$qty13', '$qty14', '$qty15', '$amt1', '$amt2', '$amt3', '$amt4', '$amt5', '$amt6', '$amt7', '$amt8', '$amt9','$amt10', '$amt11', '$amt12', '$amt13', '$amt14', '$amt15', '$totalNaira',  '$totalDollar')";

if (!mysql_query($sql,$tSaturnConn))
  {
  die('Error: ' . mysql_error());
  }
mysql_close($tSaturnConn)
?>

thanks for ur support

0

WOW.

Before i even TRY to salvage this.. can you please tell me why it is that you have 15 of each items?? With most of which being empty in your table???

I will help you. but please explain why it is that you have made such an utterly horrible DB

@tyson.crouch thanks for your time and help. All i wanted is to create a simple invoicing system. I want to be able to process up to 15 products at a time so i created (product1.....product15), (quantity1.....quantity15), (price1.....price15) and (amount1.....amount15). It was horrible!!

Thanks for the code you gave. But how do I build my HTML that transfer all info into the new Normalize DB?

MY OLD HTML IS

<form action="confirmlitOrder.php" method="post" name="sampleform">
		  
		  <table width="90%" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr> 
            <td align="left"><span class="welcomex">To:</span><br>
              <input name="name" type="text" class="inputX" id="name" value="Input Customer Name" size="25" onfocus="this.value=''"/>
              <br/> <br/>
              <textarea name="address" cols="40" rows="4" class="inputX" id="address" onfocus="this.value=''">Input Customer Address</textarea></td></tr>
          <tr align="right" valign="middle"> 
            <td align="right" valign="baseline"> 
			  <strong class="welcomexx">Click To Select Date &raquo;</strong>&nbsp;&nbsp;<a href="javascript:showCal('Calendar1')"><img src="images/calendar.png" width="20" height="19" border="0" /></a>&nbsp;
			  <input type="text" name="firstinput" size=10 class="inputX"> 			  </td>
          </tr>
  
</table>

            <table width="70%" border="1" align="center" CELLPADDING="2" CELLSPACING="0" bordercolor="<?PHP print "$BorderColour"; ?>">
            
			<tr>
              <td class="welcomexx">S/N</td>
              <td class="welcomexx">Code</td>
              <td class="welcomexx">Product Description </td>
              <td class="welcomexx">              Quantity</td>
              <td class="welcomexx">Price</td>
              <td class="welcomexx">Amount</td>
            </tr>
            <tr>
              <td class="welcomexx">1.</td>
              <td><select name="select1" class="inputX" id="select1" onchange="Ajaxifyit('select1')">
                                      <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?> 
                </Select>          </td>
              <td><input name="product1" type="text" class="inputX" id="product1" size="60"/></td>
              <td><input name="qty1" type="text" class="inputX" id="qty1" size="5" onblur="calcAmnt('qty1')" /></td>
              <td><input name="price1" type="text" class="inputX" id="price1" size="10" /></td>
              <td><input name="amt1" type="text" class="inputX" id="amt1" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">2.</td>
              <td><select name="select2" class="inputX" id="select2" onchange="Ajaxifyit('select2')">
                                      <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?> 
              </Select></td>
              <td><input name="product2" type="text" class="inputX" id="product2" size="60"/></td>
              <td><input name="qty2" type="text" class="inputX" id="qty2" size="5" onblur="calcAmnt('qty2')" /></td>
              <td><input name="price2" type="text" class="inputX" id="price2" size="10" /></td>
              <td><input name="amt2" type="text" class="inputX" id="amt2" size="10"  /></td>
            </tr>
            <tr>
              <td class="welcomexx">3</td>
              <td><select name="select3" class="inputX" id="select3" onchange="Ajaxifyit('select3')">
                                      <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?> 
              </Select></td>
              <td><input name="product3" type="text" class="inputX" id="product3" size="60" /></td>
              <td><input name="qty3" type="text" class="inputX" id="qty3" size="5" onblur="calcAmnt('qty3')"/></td>
              <td><input name="price3" type="text" class="inputX" id="price3" size="10" /></td>
              <td><input name="amt3" type="text" class="inputX" id="amt3" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">4</td>
              <td><select name="select4" class="inputX" id="select4" onchange="Ajaxifyit('select4')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product4" type="text" class="inputX" id="product4" size="60" /></td>
              <td><input name="qty4" type="text" class="inputX" id="qty4" size="5" onblur="calcAmnt('qty4')" /></td>
              <td><input name="price4" type="text" class="inputX" id="price4" size="10" /></td>
              <td><input name="amt4" type="text" class="inputX" id="amt4" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">5</td>
              <td><select name="select5" class="inputX" id="select5" onchange="Ajaxifyit('select5')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product5" type="text" class="inputX" id="product5" size="60" /></td>
              <td><input name="qty5" type="text" class="inputX" id="qty5" size="5" onblur="calcAmnt('qty5')"/></td>
              <td><input name="price5" type="text" class="inputX" id="price5" size="10" /></td>
              <td><input name="amt5" type="text" class="inputX" id="amt5" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">6</td>
              <td><select name="select6" class="inputX" id="select6" onchange="Ajaxifyit('select6')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product6" type="text" class="inputX" id="product6" size="60" /></td>
              <td><input name="qty6" type="text" class="inputX" id="qty6" size="5" onblur="calcAmnt('qty6')" /></td>
              <td><input name="price6" type="text" class="inputX" id="price6" size="10" /></td>
              <td><input name="amt6" type="text" class="inputX" id="amt6" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">7</td>
              <td><select name="select7" class="inputX" id="select7" onchange="Ajaxifyit('select7')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product7" type="text" class="inputX" id="product7" size="60" /></td>
              <td><input name="qty7" type="text" class="inputX" id="qty7" size="5" onblur="calcAmnt('qty7')" /></td>
              <td><input name="price7" type="text" class="inputX" id="price7" size="10" /></td>
              <td><input name="amt7" type="text" class="inputX" id="amt7" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">8</td>
              <td><select name="select8" class="inputX" id="select8" onchange="Ajaxifyit('select8')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product8" type="text" class="inputX" id="product8" size="60" /></td>
              <td><input name="qty8" type="text" class="inputX" id="qty8" size="5" onblur="calcAmnt('qty8')"/></td>
              <td><input name="price8" type="text" class="inputX" id="price8" size="10" /></td>
              <td><input name="amt8" type="text" class="inputX" id="amt8" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">9</td>
              <td><select name="select9" class="inputX" id="select9" onchange="Ajaxifyit('select9')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product9" type="text" class="inputX" id="product9" size="60" /></td>
              <td><input name="qty9" type="text" class="inputX" id="qty9" size="5" onblur="calcAmnt('qty9')"/></td>
              <td><input name="price9" type="text" class="inputX" id="price9" size="10" /></td>
              <td><input name="amt9" type="text" class="inputX" id="amt9" size="10" /></td>
            </tr><tr>
           <td class="welcomexx">10</td>
              <td><select name="select10" class="inputX" id="select10" onchange="Ajaxifyit('select10')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product10" type="text" class="inputX" id="product10" size="60" /></td>
              <td><input name="qty10" type="text" class="inputX" id="qty10" size="5" onblur="calcAmnt('qty10')"/></td>
              <td><input name="price10" type="text" class="inputX" id="price10" size="10" /></td>
              <td><input name="amt10" type="text" class="inputX" id="amt10" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">11</td>
              <td><select name="select11" class="inputX" id="select11" onchange="Ajaxifyit('select11')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product11" type="text" class="inputX" id="product11" size="60" /></td>
              <td><input name="qty11" type="text" class="inputX" id="qty11" size="5" onblur="calcAmnt('qty11')"/></td>
              <td><input name="price11" type="text" class="inputX" id="price11" size="10" /></td>
              <td><input name="amt11" type="text" class="inputX" id="amt11" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">12</td>
              <td><select name="select12" class="inputX" id="select12" onchange="Ajaxifyit('select12')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product12" type="text" class="inputX" id="product12" size="60" /></td>
              <td><input name="qty12" type="text" class="inputX" id="qty12" size="5" onblur="calcAmnt('qty12')"/></td>
              <td><input name="price12" type="text" class="inputX" id="price12" size="10" /></td>
              <td><input name="amt12" type="text" class="inputX" id="amt12" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">13</td>
              <td><select name="select13" class="inputX" id="select13" onchange="Ajaxifyit('select13')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product13" type="text" class="inputX" id="product13" size="60" /></td>
              <td><input name="qty13" type="text" class="inputX" id="qty13" size="5" onblur="calcAmnt('qty13')"/></td>
              <td><input name="price13" type="text" class="inputX" id="price13" size="10" /></td>
              <td><input name="amt13" type="text" class="inputX" id="amt13" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">14</td>
              <td><select name="select14" class="inputX" id="select14" onchange="Ajaxifyit('select14')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product14" type="text" class="inputX" id="product14" size="60" /></td>
              <td><input name="qty14" type="text" class="inputX" id="qty14" size="5" onblur="calcAmnt('qty14')"/></td>
              <td><input name="price14" type="text" class="inputX" id="price14" size="10" /></td>
              <td><input name="amt14" type="text" class="inputX" id="amt14" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">15</td>
              <td><select name="select15" class="inputX" id="select15" onchange="Ajaxifyit('select15')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product15" type="text" class="inputX" id="product15" size="60" /></td>
              <td><input name="qty15" type="text" class="inputX" id="qty15" size="5" onblur="calcAmnt('qty15')"/></td>
              <td><input name="price15" type="text" class="inputX" id="price15" size="10" /></td>
              <td><input name="amt15" type="text" class="inputX" id="amt15" size="10" /></td><tr/>

		    <tr>
              <td colspan="6" class="welcomexx"><div align="right">
                <input name="Submit" type="submit" class="goZ" value="&raquo; &raquo; Review Invoice" />
              </div></td>
              </tr>
          </table>
          </form>

Then i confirm

<form action="print_lit_Order.php" method="post" name="sampleform">
		  
		  <table width="90%" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr> 
            <td align="left"><span class="welcomex">To:</span><br>
              <input name="name" type="text" class="inputX" id="name" value="<?php print $name; ?>" size="25" onfocus="this.value=''"/>
              <br>
              <textarea name="address" cols="40" rows="4" class="inputX" id="address" onfocus="this.value=''"><?php print str_replace("\n", "<br>", $address); ?></textarea></td></tr>
          <tr align="right" valign="middle"> 
            <td align="right" valign="baseline"> 
			  <strong class="welcomexx">Click To Select Date &raquo;</strong>&nbsp;&nbsp;<a href="javascript:showCal('Calendar1')"></a>&nbsp;
			  <input name="firstinput" type="text" class="inputX" value="<?php print $date; ?>" size=10> 			  </td>
          </tr>
  
</table>

            <table width="70%" border="1" align="center" CELLPADDING="2" CELLSPACING="0" bordercolor="<?PHP print "$BorderColour"; ?>">
            
			<tr>
              <td class="welcomexx">S/N</td>
              <td class="welcomexx">Code</td>
              <td class="welcomexx">Product Description </td>
              <td class="welcomexx">Quantity</td>
              <td class="welcomexx">Price</td>
              <td class="welcomexx">Amount</td>
            </tr>
            <tr>
              <td class="welcomexx">1.</td>
              <td><input name="select1" type="text" class="inputX" id="select1" value="<?php print $select1; ?>" size="10" /></td>
              <td><input name="product1" type="text" class="inputX" id="product1" value="<?php print $product1; ?>" size="60"/></td>
              <td><input name="qty1" type="text" class="inputX" id="qty1" onblur="calcAmnt('qty1')" value="<?php print $qty1; ?>" size="5" /></td>
              <td><input name="price1" type="text" class="inputX" id="price1" value="<?php print $price1; ?>" size="10" /></td>
              <td><input name="amt1" type="text" class="inputX" id="amt1" value="<?php print $amt1; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">2.</td>
              <td><input name="select2" type="text" class="inputX" id="select2" value="<?php print $select2; ?>" size="10" /></td>
              <td><input name="product2" type="text" class="inputX" id="product2" value="<?php print $product2; ?>" size="60"/></td>
              <td><input name="qty2" type="text" class="inputX" id="qty2" onblur="calcAmnt('qty2')" value="<?php print $qty2; ?>" size="5" /></td>
              <td><input name="price2" type="text" class="inputX" id="price2" value="<?php print $price2; ?>" size="10" /></td>
              <td><input name="amt2" type="text" class="inputX" id="amt2" value="<?php print $amt2; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">3</td>
              <td><input name="select3" type="text" class="inputX" id="select3" value="<?php print $select3; ?>" size="10" /></td>
              <td><input name="product3" type="text" class="inputX" id="product3" value="<?php print $product3; ?>" size="60"/></td>
              <td><input name="qty3" type="text" class="inputX" id="qty3" onblur="calcAmnt('qty3')" value="<?php print $qty3; ?>" size="5" /></td>
              <td><input name="price3" type="text" class="inputX" id="price3" value="<?php print $price3; ?>" size="10" /></td>
              <td><input name="amt3" type="text" class="inputX" id="amt3" value="<?php print $amt3; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">4</td>
              <td><input name="select4" type="text" class="inputX" id="select4" value="<?php print $select4; ?>" size="10" /></td>
              <td><input name="product4" type="text" class="inputX" id="product4" value="<?php print $product4; ?>" size="60"/></td>
              <td><input name="qty4" type="text" class="inputX" id="qty4" onblur="calcAmnt('qty4')" value="<?php print $qty4; ?>" size="5" /></td>
              <td><input name="price4" type="text" class="inputX" id="price4" value="<?php print $price4; ?>" size="10" /></td>
              <td><input name="amt4" type="text" class="inputX" id="amt4" value="<?php print $amt4; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">5</td>
              <td><input name="select5" type="text" class="inputX" id="select5" value="<?php print $select5; ?>" size="10" /></td>
              <td><input name="product5" type="text" class="inputX" id="product5" value="<?php print $product5; ?>" size="60"/></td>
              <td><input name="qty5" type="text" class="inputX" id="qty5" onblur="calcAmnt('qty5')" value="<?php print $qty5; ?>" size="5" /></td>
              <td><input name="price5" type="text" class="inputX" id="price5" value="<?php print $price5; ?>" size="10" /></td>
              <td><input name="amt5" type="text" class="inputX" id="amt5" value="<?php print $amt5; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">6</td>
              <td><input name="select6" type="text" class="inputX" id="select6" value="<?php print $select6; ?>" size="10" /></td>
              <td><input name="product6" type="text" class="inputX" id="product6" value="<?php print $product6; ?>" size="60"/></td>
              <td><input name="qty6" type="text" class="inputX" id="qty6" onblur="calcAmnt('qty6')" value="<?php print $qty6; ?>" size="5" /></td>
              <td><input name="price6" type="text" class="inputX" id="price6" value="<?php print $price6; ?>" size="10" /></td>
              <td><input name="amt6" type="text" class="inputX" id="amt6" value="<?php print $amt6; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">7</td>
              <td><input name="select7" type="text" class="inputX" id="select7" value="<?php print $select7; ?>" size="10" /></td>
              <td><input name="product7" type="text" class="inputX" id="product7" value="<?php print $product7; ?>" size="60"/></td>
              <td><input name="qty7" type="text" class="inputX" id="qty7" onblur="calcAmnt('qty7')" value="<?php print $qty7; ?>" size="5" /></td>
              <td><input name="price7" type="text" class="inputX" id="price7" value="<?php print $price7; ?>" size="10" /></td>
              <td><input name="amt7" type="text" class="inputX" id="amt7" value="<?php print $amt7; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">8</td>
              <td><input name="select8" type="text" class="inputX" id="select8" value="<?php print $select8; ?>" size="10" /></td>
              <td><input name="product8" type="text" class="inputX" id="product8" value="<?php print $product8; ?>" size="60"/></td>
              <td><input name="qty8" type="text" class="inputX" id="qty8" onblur="calcAmnt('qty8')" value="<?php print $qty8; ?>" size="5" /></td>
              <td><input name="price8" type="text" class="inputX" id="price8" value="<?php print $price8; ?>" size="10" /></td>
              <td><input name="amt8" type="text" class="inputX" id="amt8" value="<?php print $amt8; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">9</td>
              <td><input name="select9" type="text" class="inputX" id="select9" value="<?php print $select9; ?>" size="10" /></td>
              <td><input name="product9" type="text" class="inputX" id="product9" value="<?php print $product9; ?>" size="60"/></td>
              <td><input name="qty9" type="text" class="inputX" id="qty9" onblur="calcAmnt('qty9')" value="<?php print $qty9; ?>" size="5" /></td>
              <td><input name="price9" type="text" class="inputX" id="price9" value="<?php print $price9; ?>" size="10" /></td>
              <td><input name="amt9" type="text" class="inputX" id="amt9" value="<?php print $amt9; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">10</td>
              <td><input name="select10" type="text" class="inputX" id="select10" value="<?php print $select10; ?>" size="10" /></td>
              <td><input name="product10" type="text" class="inputX" id="product10" value="<?php print $product10; ?>" size="60"/></td>
              <td><input name="qty10" type="text" class="inputX" id="qty10" onblur="calcAmnt('qty10')" value="<?php print $qty10; ?>" size="5" /></td>
              <td><input name="price10" type="text" class="inputX" id="price10" value="<?php print $price10; ?>" size="10" /></td>
              <td><input name="amt10" type="text" class="inputX" id="amt10" value="<?php print $amt10; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">11</td>
              <td><input name="select11" type="text" class="inputX" id="select11" value="<?php print $select11; ?>" size="10" /></td>
              <td><input name="product11" type="text" class="inputX" id="product11" value="<?php print $product11; ?>" size="60"/></td>
              <td><input name="qty11" type="text" class="inputX" id="qty11" onblur="calcAmnt('qty11')" value="<?php print $qty11; ?>" size="5" /></td>
              <td><input name="price11" type="text" class="inputX" id="price11" value="<?php print $price11; ?>" size="10" /></td>
              <td><input name="amt11" type="text" class="inputX" id="amt11" value="<?php print $amt11; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">12</td>
              <td><input name="select12" type="text" class="inputX" id="select12" value="<?php print $select12; ?>" size="10" /></td>
              <td><input name="product12" type="text" class="inputX" id="product12" value="<?php print $product12; ?>" size="60"/></td>
              <td><input name="qty12" type="text" class="inputX" id="qty12" onblur="calcAmnt('qty12')" value="<?php print $qty12; ?>" size="5" /></td>
              <td><input name="price12" type="text" class="inputX" id="price12" value="<?php print $price12; ?>" size="10" /></td>
              <td><input name="amt12" type="text" class="inputX" id="amt12" value="<?php print $amt12; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">13</td>
              <td><input name="select13" type="text" class="inputX" id="select13" value="<?php print $select13; ?>" size="10" /></td>
              <td><input name="product13" type="text" class="inputX" id="product13" value="<?php print $product13; ?>" size="60"/></td>
              <td><input name="qty13" type="text" class="inputX" id="qty13" onblur="calcAmnt('qty13')" value="<?php print $qty13; ?>" size="5" /></td>
              <td><input name="price13" type="text" class="inputX" id="price13" value="<?php print $price13; ?>" size="10" /></td>
              <td><input name="amt13" type="text" class="inputX" id="amt13" value="<?php print $amt13; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">14</td>
              <td><input name="select14" type="text" class="inputX" id="select14" value="<?php print $select14; ?>" size="10" /></td>
              <td><input name="product14" type="text" class="inputX" id="product14" value="<?php print $product14; ?>" size="60"/></td>
              <td><input name="qty14" type="text" class="inputX" id="qty14" onblur="calcAmnt('qty14')" value="<?php print $qty14; ?>" size="5" /></td>
              <td><input name="price14" type="text" class="inputX" id="price14" value="<?php print $price14; ?>" size="10" /></td>
              <td><input name="amt14" type="text" class="inputX" id="amt14" value="<?php print $amt14; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">15</td>
              <td><input name="select15" type="text" class="inputX" id="select15" value="<?php print $select15; ?>" size="10" /></td>
              <td><input name="product15" type="text" class="inputX" id="product15" value="<?php print $product15; ?>" size="60"/></td>
              <td><input name="qty15" type="text" class="inputX" id="qty15" onblur="calcAmnt('qty15')" value="<?php print $qty15; ?>" size="5" /></td>
              <td><input name="price15" type="text" class="inputX" id="price15" value="<?php print $price15; ?>" size="10" /></td>
              <td><input name="amt15" type="text" class="inputX" id="amt15" value="<?php print $amt15; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td colspan="6" align="right" valign="top" class="welcomexx"><table width="60%" border="0" cellspacing="2" cellpadding="2">
                <tr>
                  <td width="28%" align="right">Total in Naira (<img src="images/naira.jpg" width="9" height="11" />) </td>
                  <td width="16%"><input name="totalNaira" type="text" class="inputX" id="totalNaira" value="<?php print number_format($totalNaira); ?>" size="10" /></td>
                  <td width="34%" align="right">Total in Dollars $</td>
                  <td width="22%"><input name="totalDollar" type="text" class="inputX" id="totalDollar" value="<?php print number_format($totalDollar); ?>" size="10" /></td>
                </tr>
              </table></td>
              </tr>
            <tr>
              <td colspan="5" class="welcomexx"><input name="dollarRate" type="hidden" id="dollarRate" value="<?php echo $rate; ?>" /></td>
              <td class="welcomexx"><input name="Submit" type="submit" class="goZ" value="&raquo; &raquo; Process Invoice" /></td>
            </tr>
          </table>
          </form>

Next is to Print a copy and also send a copy into the DB which i do with

<?php 
//Get Client Details
$name = $_POST['name'];
$address = $_POST['address'];
$date = $_POST['firstinput'];
//Get Codes
$select1 = $_POST['select1'];
$select2 = $_POST['select2'];
$select3 = $_POST['select3'];
$select4 = $_POST['select4'];
$select5 = $_POST['select5'];
$select6 = $_POST['select6'];
$select7 = $_POST['select7'];
$select8 = $_POST['select8'];
$select9 = $_POST['select9'];
$select10 = $_POST['select10'];
$select11 = $_POST['select11'];
$select12 = $_POST['select12'];
$select13 = $_POST['select13'];
$select14 = $_POST['select14'];
$select15 = $_POST['select15'];

//Get Products
$product1 = $_POST['product1'];
$product2 = $_POST['product2'];
$product3 = $_POST['product3'];
$product4 = $_POST['product4'];
$product5 = $_POST['product5'];
$product6 = $_POST['product6'];
$product7 = $_POST['product7'];
$product8 = $_POST['product8'];
$product9 = $_POST['product9'];
$product10 = $_POST['product10'];
$product11 = $_POST['product11'];
$product12 = $_POST['product12'];
$product13 = $_POST['product13'];
$product14 = $_POST['product14'];
$product15 = $_POST['product15'];

//Get Prices
$price1 = $_POST['price1'];
$price2 = $_POST['price2'];
$price3 = $_POST['price3'];
$price4 = $_POST['price4'];
$price5 = $_POST['price5'];
$price6 = $_POST['price6'];
$price7 = $_POST['price7'];
$price8 = $_POST['price8'];
$price9 = $_POST['price9'];
$price10 = $_POST['price10'];
$price11 = $_POST['price11'];
$price12 = $_POST['price12'];
$price13 = $_POST['price13'];
$price14 = $_POST['price14'];
$price15 = $_POST['price15'];

//Get Quantity
$qty1 = $_POST['qty1'];
$qty2 = $_POST['qty2'];
$qty3 = $_POST['qty3'];
$qty4 = $_POST['qty4'];
$qty5 = $_POST['qty5'];
$qty6 = $_POST['qty6'];
$qty7 = $_POST['qty7'];
$qty8 = $_POST['qty8'];
$qty9 = $_POST['qty9'];
$qty10 = $_POST['qty10'];
$qty11 = $_POST['qty11'];
$qty12 = $_POST['qty12'];
$qty13 = $_POST['qty13'];
$qty14 = $_POST['qty14'];
$qty15 = $_POST['qty15'];

//Get Amount
$amt1 = $_POST['amt1'];
$amt2 = $_POST['amt2'];
$amt3 = $_POST['amt3'];
$amt4 = $_POST['amt4'];
$amt5 = $_POST['amt5'];
$amt6 = $_POST['amt6'];
$amt7 = $_POST['amt7'];
$amt8 = $_POST['amt8'];
$amt9 = $_POST['amt9'];
$amt10 = $_POST['amt10'];
$amt11 = $_POST['amt11'];
$amt12 = $_POST['amt12'];
$amt13 = $_POST['amt13'];
$amt14 = $_POST['amt14'];
$amt15 = $_POST['amt15'];
$totalNaira=$amt1+$amt2+$amt3+$amt4+$amt5+$amt6+$amt7+$amt8+$amt9+$amt10+$amt11+$amt12+$amt13+$amt14+$amt15;
$totalDollar=$totalNaira/$rate;
?>

<?php
mysql_select_db($database_tSaturnConn, $tSaturnConn);
$sql="INSERT INTO litorder (name, address, xdate, code1, code2, code3, code4, code5, code6, code7, code8, code9, code10, code11, code12, code13, code14, code15, product1, product2, product3, product4, product5, product6, product7, product8, product9, product10, product11, product12, product13, product14, product15, price1, price2, price3, price4, price5, price6, price7, price8, price9, price10, price11, price12, price13, price14, price15, quantity1, quantity2, quantity3, quantity4, quantity5, quantity6, quantity7, quantity8, quantity9, quantity10, quantity11, quantity12, quantity13, quantity14, quantity15, amount1, amount2, amount3, amount4, amount5, amount6, amount7, amount8, amount9, amount10, amount11, amount12, amount13, amount14, amount15, totalNaira, totalDollar) VALUES ('$name', '$address',  '$date', '$select1', '$select2', '$select3', '$select4', '$select5', '$select6', '$select7', '$select8', '$select9','$select10', '$select11', '$select12', '$select13', '$select14', '$select15', '$product1', '$product2', '$product3', '$product4', '$product5', '$product6', '$product7', '$product8', '$product9','$product10', '$product11', '$product12', '$product13', '$product14', '$product15', '$price1', '$price2', '$price3', '$price4', '$price5', '$price6', '$price7', '$price8', '$price9','$price10', '$price11', '$price12', '$price13', '$price14', '$price15', '$qty1', '$qty2', '$qty3', '$qty4', '$qty5', '$qty6', '$qty7', '$qty8', '$qty9','$qty10', '$qty11', '$qty12', '$qty13', '$qty14', '$qty15', '$amt1', '$amt2', '$amt3', '$amt4', '$amt5', '$amt6', '$amt7', '$amt8', '$amt9','$amt10', '$amt11', '$amt12', '$amt13', '$amt14', '$amt15', '$totalNaira',  '$totalDollar')";

if (!mysql_query($sql,$tSaturnConn))
  {
  die('Error: ' . mysql_error());
  }
mysql_close($tSaturnConn)
?>

thanks for ur support

0

WOW.

Before i even TRY to salvage this.. can you please tell me why it is that you have 15 of each items?? With most of which being empty in your table???

I will help you. but please explain why it is that you have made such an utterly horrible DB

@tyson.crouch thanks for your time and help. All i wanted is to create a simple invoicing system. I want to be able to process up to 15 products at a time so i created (product1.....product15), (quantity1.....quantity15), (price1.....price15) and (amount1.....amount15). It was horrible!!

Thanks for the code you gave. But how do I build my HTML that transfer all info into the new Normalize DB?

MY OLD HTML IS

<form action="confirmlitOrder.php" method="post" name="sampleform">
		  
		  <table width="90%" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr> 
            <td align="left"><span class="welcomex">To:</span><br>
              <input name="name" type="text" class="inputX" id="name" value="Input Customer Name" size="25" onfocus="this.value=''"/>
              <br/> <br/>
              <textarea name="address" cols="40" rows="4" class="inputX" id="address" onfocus="this.value=''">Input Customer Address</textarea></td></tr>
          <tr align="right" valign="middle"> 
            <td align="right" valign="baseline"> 
			  <strong class="welcomexx">Click To Select Date &raquo;</strong>&nbsp;&nbsp;<a href="javascript:showCal('Calendar1')"><img src="images/calendar.png" width="20" height="19" border="0" /></a>&nbsp;
			  <input type="text" name="firstinput" size=10 class="inputX"> 			  </td>
          </tr>
  
</table>

            <table width="70%" border="1" align="center" CELLPADDING="2" CELLSPACING="0" bordercolor="<?PHP print "$BorderColour"; ?>">
            
			<tr>
              <td class="welcomexx">S/N</td>
              <td class="welcomexx">Code</td>
              <td class="welcomexx">Product Description </td>
              <td class="welcomexx">              Quantity</td>
              <td class="welcomexx">Price</td>
              <td class="welcomexx">Amount</td>
            </tr>
            <tr>
              <td class="welcomexx">1.</td>
              <td><select name="select1" class="inputX" id="select1" onchange="Ajaxifyit('select1')">
                                      <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?> 
                </Select>          </td>
              <td><input name="product1" type="text" class="inputX" id="product1" size="60"/></td>
              <td><input name="qty1" type="text" class="inputX" id="qty1" size="5" onblur="calcAmnt('qty1')" /></td>
              <td><input name="price1" type="text" class="inputX" id="price1" size="10" /></td>
              <td><input name="amt1" type="text" class="inputX" id="amt1" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">2.</td>
              <td><select name="select2" class="inputX" id="select2" onchange="Ajaxifyit('select2')">
                                      <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?> 
              </Select></td>
              <td><input name="product2" type="text" class="inputX" id="product2" size="60"/></td>
              <td><input name="qty2" type="text" class="inputX" id="qty2" size="5" onblur="calcAmnt('qty2')" /></td>
              <td><input name="price2" type="text" class="inputX" id="price2" size="10" /></td>
              <td><input name="amt2" type="text" class="inputX" id="amt2" size="10"  /></td>
            </tr>
            <tr>
              <td class="welcomexx">3</td>
              <td><select name="select3" class="inputX" id="select3" onchange="Ajaxifyit('select3')">
                                      <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?> 
              </Select></td>
              <td><input name="product3" type="text" class="inputX" id="product3" size="60" /></td>
              <td><input name="qty3" type="text" class="inputX" id="qty3" size="5" onblur="calcAmnt('qty3')"/></td>
              <td><input name="price3" type="text" class="inputX" id="price3" size="10" /></td>
              <td><input name="amt3" type="text" class="inputX" id="amt3" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">4</td>
              <td><select name="select4" class="inputX" id="select4" onchange="Ajaxifyit('select4')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product4" type="text" class="inputX" id="product4" size="60" /></td>
              <td><input name="qty4" type="text" class="inputX" id="qty4" size="5" onblur="calcAmnt('qty4')" /></td>
              <td><input name="price4" type="text" class="inputX" id="price4" size="10" /></td>
              <td><input name="amt4" type="text" class="inputX" id="amt4" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">5</td>
              <td><select name="select5" class="inputX" id="select5" onchange="Ajaxifyit('select5')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product5" type="text" class="inputX" id="product5" size="60" /></td>
              <td><input name="qty5" type="text" class="inputX" id="qty5" size="5" onblur="calcAmnt('qty5')"/></td>
              <td><input name="price5" type="text" class="inputX" id="price5" size="10" /></td>
              <td><input name="amt5" type="text" class="inputX" id="amt5" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">6</td>
              <td><select name="select6" class="inputX" id="select6" onchange="Ajaxifyit('select6')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product6" type="text" class="inputX" id="product6" size="60" /></td>
              <td><input name="qty6" type="text" class="inputX" id="qty6" size="5" onblur="calcAmnt('qty6')" /></td>
              <td><input name="price6" type="text" class="inputX" id="price6" size="10" /></td>
              <td><input name="amt6" type="text" class="inputX" id="amt6" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">7</td>
              <td><select name="select7" class="inputX" id="select7" onchange="Ajaxifyit('select7')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product7" type="text" class="inputX" id="product7" size="60" /></td>
              <td><input name="qty7" type="text" class="inputX" id="qty7" size="5" onblur="calcAmnt('qty7')" /></td>
              <td><input name="price7" type="text" class="inputX" id="price7" size="10" /></td>
              <td><input name="amt7" type="text" class="inputX" id="amt7" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">8</td>
              <td><select name="select8" class="inputX" id="select8" onchange="Ajaxifyit('select8')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product8" type="text" class="inputX" id="product8" size="60" /></td>
              <td><input name="qty8" type="text" class="inputX" id="qty8" size="5" onblur="calcAmnt('qty8')"/></td>
              <td><input name="price8" type="text" class="inputX" id="price8" size="10" /></td>
              <td><input name="amt8" type="text" class="inputX" id="amt8" size="10" /></td>
            </tr>
            <tr>
              <td class="welcomexx">9</td>
              <td><select name="select9" class="inputX" id="select9" onchange="Ajaxifyit('select9')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product9" type="text" class="inputX" id="product9" size="60" /></td>
              <td><input name="qty9" type="text" class="inputX" id="qty9" size="5" onblur="calcAmnt('qty9')"/></td>
              <td><input name="price9" type="text" class="inputX" id="price9" size="10" /></td>
              <td><input name="amt9" type="text" class="inputX" id="amt9" size="10" /></td>
            </tr><tr>
           <td class="welcomexx">10</td>
              <td><select name="select10" class="inputX" id="select10" onchange="Ajaxifyit('select10')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product10" type="text" class="inputX" id="product10" size="60" /></td>
              <td><input name="qty10" type="text" class="inputX" id="qty10" size="5" onblur="calcAmnt('qty10')"/></td>
              <td><input name="price10" type="text" class="inputX" id="price10" size="10" /></td>
              <td><input name="amt10" type="text" class="inputX" id="amt10" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">11</td>
              <td><select name="select11" class="inputX" id="select11" onchange="Ajaxifyit('select11')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product11" type="text" class="inputX" id="product11" size="60" /></td>
              <td><input name="qty11" type="text" class="inputX" id="qty11" size="5" onblur="calcAmnt('qty11')"/></td>
              <td><input name="price11" type="text" class="inputX" id="price11" size="10" /></td>
              <td><input name="amt11" type="text" class="inputX" id="amt11" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">12</td>
              <td><select name="select12" class="inputX" id="select12" onchange="Ajaxifyit('select12')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product12" type="text" class="inputX" id="product12" size="60" /></td>
              <td><input name="qty12" type="text" class="inputX" id="qty12" size="5" onblur="calcAmnt('qty12')"/></td>
              <td><input name="price12" type="text" class="inputX" id="price12" size="10" /></td>
              <td><input name="amt12" type="text" class="inputX" id="amt12" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">13</td>
              <td><select name="select13" class="inputX" id="select13" onchange="Ajaxifyit('select13')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product13" type="text" class="inputX" id="product13" size="60" /></td>
              <td><input name="qty13" type="text" class="inputX" id="qty13" size="5" onblur="calcAmnt('qty13')"/></td>
              <td><input name="price13" type="text" class="inputX" id="price13" size="10" /></td>
              <td><input name="amt13" type="text" class="inputX" id="amt13" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">14</td>
              <td><select name="select14" class="inputX" id="select14" onchange="Ajaxifyit('select14')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product14" type="text" class="inputX" id="product14" size="60" /></td>
              <td><input name="qty14" type="text" class="inputX" id="qty14" size="5" onblur="calcAmnt('qty14')"/></td>
              <td><input name="price14" type="text" class="inputX" id="price14" size="10" /></td>
              <td><input name="amt14" type="text" class="inputX" id="amt14" size="10" /></td><tr/>
<tr>
           <td class="welcomexx">15</td>
              <td><select name="select15" class="inputX" id="select15" onchange="Ajaxifyit('select15')">
                <?php
					$sql='SELECT code,productName,price FROM literaturelist GROUP BY code';
					$data='code';
					queries($sql,$data);			    		  
								  ?>
                            </select></td>
              <td><input name="product15" type="text" class="inputX" id="product15" size="60" /></td>
              <td><input name="qty15" type="text" class="inputX" id="qty15" size="5" onblur="calcAmnt('qty15')"/></td>
              <td><input name="price15" type="text" class="inputX" id="price15" size="10" /></td>
              <td><input name="amt15" type="text" class="inputX" id="amt15" size="10" /></td><tr/>

		    <tr>
              <td colspan="6" class="welcomexx"><div align="right">
                <input name="Submit" type="submit" class="goZ" value="&raquo; &raquo; Review Invoice" />
              </div></td>
              </tr>
          </table>
          </form>

Then i confirm

<form action="print_lit_Order.php" method="post" name="sampleform">
		  
		  <table width="90%" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr> 
            <td align="left"><span class="welcomex">To:</span><br>
              <input name="name" type="text" class="inputX" id="name" value="<?php print $name; ?>" size="25" onfocus="this.value=''"/>
              <br>
              <textarea name="address" cols="40" rows="4" class="inputX" id="address" onfocus="this.value=''"><?php print str_replace("\n", "<br>", $address); ?></textarea></td></tr>
          <tr align="right" valign="middle"> 
            <td align="right" valign="baseline"> 
			  <strong class="welcomexx">Click To Select Date &raquo;</strong>&nbsp;&nbsp;<a href="javascript:showCal('Calendar1')"></a>&nbsp;
			  <input name="firstinput" type="text" class="inputX" value="<?php print $date; ?>" size=10> 			  </td>
          </tr>
  
</table>

            <table width="70%" border="1" align="center" CELLPADDING="2" CELLSPACING="0" bordercolor="<?PHP print "$BorderColour"; ?>">
            
			<tr>
              <td class="welcomexx">S/N</td>
              <td class="welcomexx">Code</td>
              <td class="welcomexx">Product Description </td>
              <td class="welcomexx">Quantity</td>
              <td class="welcomexx">Price</td>
              <td class="welcomexx">Amount</td>
            </tr>
            <tr>
              <td class="welcomexx">1.</td>
              <td><input name="select1" type="text" class="inputX" id="select1" value="<?php print $select1; ?>" size="10" /></td>
              <td><input name="product1" type="text" class="inputX" id="product1" value="<?php print $product1; ?>" size="60"/></td>
              <td><input name="qty1" type="text" class="inputX" id="qty1" onblur="calcAmnt('qty1')" value="<?php print $qty1; ?>" size="5" /></td>
              <td><input name="price1" type="text" class="inputX" id="price1" value="<?php print $price1; ?>" size="10" /></td>
              <td><input name="amt1" type="text" class="inputX" id="amt1" value="<?php print $amt1; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">2.</td>
              <td><input name="select2" type="text" class="inputX" id="select2" value="<?php print $select2; ?>" size="10" /></td>
              <td><input name="product2" type="text" class="inputX" id="product2" value="<?php print $product2; ?>" size="60"/></td>
              <td><input name="qty2" type="text" class="inputX" id="qty2" onblur="calcAmnt('qty2')" value="<?php print $qty2; ?>" size="5" /></td>
              <td><input name="price2" type="text" class="inputX" id="price2" value="<?php print $price2; ?>" size="10" /></td>
              <td><input name="amt2" type="text" class="inputX" id="amt2" value="<?php print $amt2; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">3</td>
              <td><input name="select3" type="text" class="inputX" id="select3" value="<?php print $select3; ?>" size="10" /></td>
              <td><input name="product3" type="text" class="inputX" id="product3" value="<?php print $product3; ?>" size="60"/></td>
              <td><input name="qty3" type="text" class="inputX" id="qty3" onblur="calcAmnt('qty3')" value="<?php print $qty3; ?>" size="5" /></td>
              <td><input name="price3" type="text" class="inputX" id="price3" value="<?php print $price3; ?>" size="10" /></td>
              <td><input name="amt3" type="text" class="inputX" id="amt3" value="<?php print $amt3; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">4</td>
              <td><input name="select4" type="text" class="inputX" id="select4" value="<?php print $select4; ?>" size="10" /></td>
              <td><input name="product4" type="text" class="inputX" id="product4" value="<?php print $product4; ?>" size="60"/></td>
              <td><input name="qty4" type="text" class="inputX" id="qty4" onblur="calcAmnt('qty4')" value="<?php print $qty4; ?>" size="5" /></td>
              <td><input name="price4" type="text" class="inputX" id="price4" value="<?php print $price4; ?>" size="10" /></td>
              <td><input name="amt4" type="text" class="inputX" id="amt4" value="<?php print $amt4; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">5</td>
              <td><input name="select5" type="text" class="inputX" id="select5" value="<?php print $select5; ?>" size="10" /></td>
              <td><input name="product5" type="text" class="inputX" id="product5" value="<?php print $product5; ?>" size="60"/></td>
              <td><input name="qty5" type="text" class="inputX" id="qty5" onblur="calcAmnt('qty5')" value="<?php print $qty5; ?>" size="5" /></td>
              <td><input name="price5" type="text" class="inputX" id="price5" value="<?php print $price5; ?>" size="10" /></td>
              <td><input name="amt5" type="text" class="inputX" id="amt5" value="<?php print $amt5; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">6</td>
              <td><input name="select6" type="text" class="inputX" id="select6" value="<?php print $select6; ?>" size="10" /></td>
              <td><input name="product6" type="text" class="inputX" id="product6" value="<?php print $product6; ?>" size="60"/></td>
              <td><input name="qty6" type="text" class="inputX" id="qty6" onblur="calcAmnt('qty6')" value="<?php print $qty6; ?>" size="5" /></td>
              <td><input name="price6" type="text" class="inputX" id="price6" value="<?php print $price6; ?>" size="10" /></td>
              <td><input name="amt6" type="text" class="inputX" id="amt6" value="<?php print $amt6; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">7</td>
              <td><input name="select7" type="text" class="inputX" id="select7" value="<?php print $select7; ?>" size="10" /></td>
              <td><input name="product7" type="text" class="inputX" id="product7" value="<?php print $product7; ?>" size="60"/></td>
              <td><input name="qty7" type="text" class="inputX" id="qty7" onblur="calcAmnt('qty7')" value="<?php print $qty7; ?>" size="5" /></td>
              <td><input name="price7" type="text" class="inputX" id="price7" value="<?php print $price7; ?>" size="10" /></td>
              <td><input name="amt7" type="text" class="inputX" id="amt7" value="<?php print $amt7; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">8</td>
              <td><input name="select8" type="text" class="inputX" id="select8" value="<?php print $select8; ?>" size="10" /></td>
              <td><input name="product8" type="text" class="inputX" id="product8" value="<?php print $product8; ?>" size="60"/></td>
              <td><input name="qty8" type="text" class="inputX" id="qty8" onblur="calcAmnt('qty8')" value="<?php print $qty8; ?>" size="5" /></td>
              <td><input name="price8" type="text" class="inputX" id="price8" value="<?php print $price8; ?>" size="10" /></td>
              <td><input name="amt8" type="text" class="inputX" id="amt8" value="<?php print $amt8; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
            <tr>
              <td class="welcomexx">9</td>
              <td><input name="select9" type="text" class="inputX" id="select9" value="<?php print $select9; ?>" size="10" /></td>
              <td><input name="product9" type="text" class="inputX" id="product9" value="<?php print $product9; ?>" size="60"/></td>
              <td><input name="qty9" type="text" class="inputX" id="qty9" onblur="calcAmnt('qty9')" value="<?php print $qty9; ?>" size="5" /></td>
              <td><input name="price9" type="text" class="inputX" id="price9" value="<?php print $price9; ?>" size="10" /></td>
              <td><input name="amt9" type="text" class="inputX" id="amt9" value="<?php print $amt9; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">10</td>
              <td><input name="select10" type="text" class="inputX" id="select10" value="<?php print $select10; ?>" size="10" /></td>
              <td><input name="product10" type="text" class="inputX" id="product10" value="<?php print $product10; ?>" size="60"/></td>
              <td><input name="qty10" type="text" class="inputX" id="qty10" onblur="calcAmnt('qty10')" value="<?php print $qty10; ?>" size="5" /></td>
              <td><input name="price10" type="text" class="inputX" id="price10" value="<?php print $price10; ?>" size="10" /></td>
              <td><input name="amt10" type="text" class="inputX" id="amt10" value="<?php print $amt10; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">11</td>
              <td><input name="select11" type="text" class="inputX" id="select11" value="<?php print $select11; ?>" size="10" /></td>
              <td><input name="product11" type="text" class="inputX" id="product11" value="<?php print $product11; ?>" size="60"/></td>
              <td><input name="qty11" type="text" class="inputX" id="qty11" onblur="calcAmnt('qty11')" value="<?php print $qty11; ?>" size="5" /></td>
              <td><input name="price11" type="text" class="inputX" id="price11" value="<?php print $price11; ?>" size="10" /></td>
              <td><input name="amt11" type="text" class="inputX" id="amt11" value="<?php print $amt11; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">12</td>
              <td><input name="select12" type="text" class="inputX" id="select12" value="<?php print $select12; ?>" size="10" /></td>
              <td><input name="product12" type="text" class="inputX" id="product12" value="<?php print $product12; ?>" size="60"/></td>
              <td><input name="qty12" type="text" class="inputX" id="qty12" onblur="calcAmnt('qty12')" value="<?php print $qty12; ?>" size="5" /></td>
              <td><input name="price12" type="text" class="inputX" id="price12" value="<?php print $price12; ?>" size="10" /></td>
              <td><input name="amt12" type="text" class="inputX" id="amt12" value="<?php print $amt12; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">13</td>
              <td><input name="select13" type="text" class="inputX" id="select13" value="<?php print $select13; ?>" size="10" /></td>
              <td><input name="product13" type="text" class="inputX" id="product13" value="<?php print $product13; ?>" size="60"/></td>
              <td><input name="qty13" type="text" class="inputX" id="qty13" onblur="calcAmnt('qty13')" value="<?php print $qty13; ?>" size="5" /></td>
              <td><input name="price13" type="text" class="inputX" id="price13" value="<?php print $price13; ?>" size="10" /></td>
              <td><input name="amt13" type="text" class="inputX" id="amt13" value="<?php print $amt13; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">14</td>
              <td><input name="select14" type="text" class="inputX" id="select14" value="<?php print $select14; ?>" size="10" /></td>
              <td><input name="product14" type="text" class="inputX" id="product14" value="<?php print $product14; ?>" size="60"/></td>
              <td><input name="qty14" type="text" class="inputX" id="qty14" onblur="calcAmnt('qty14')" value="<?php print $qty14; ?>" size="5" /></td>
              <td><input name="price14" type="text" class="inputX" id="price14" value="<?php print $price14; ?>" size="10" /></td>
              <td><input name="amt14" type="text" class="inputX" id="amt14" value="<?php print $amt14; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td class="welcomexx">15</td>
              <td><input name="select15" type="text" class="inputX" id="select15" value="<?php print $select15; ?>" size="10" /></td>
              <td><input name="product15" type="text" class="inputX" id="product15" value="<?php print $product15; ?>" size="60"/></td>
              <td><input name="qty15" type="text" class="inputX" id="qty15" onblur="calcAmnt('qty15')" value="<?php print $qty15; ?>" size="5" /></td>
              <td><input name="price15" type="text" class="inputX" id="price15" value="<?php print $price15; ?>" size="10" /></td>
              <td><input name="amt15" type="text" class="inputX" id="amt15" value="<?php print $amt15; ?>" size="10" onfocus="realTimeChange()" /></td>
            </tr>
			<tr>
              <td colspan="6" align="right" valign="top" class="welcomexx"><table width="60%" border="0" cellspacing="2" cellpadding="2">
                <tr>
                  <td width="28%" align="right">Total in Naira (<img src="images/naira.jpg" width="9" height="11" />) </td>
                  <td width="16%"><input name="totalNaira" type="text" class="inputX" id="totalNaira" value="<?php print number_format($totalNaira); ?>" size="10" /></td>
                  <td width="34%" align="right">Total in Dollars $</td>
                  <td width="22%"><input name="totalDollar" type="text" class="inputX" id="totalDollar" value="<?php print number_format($totalDollar); ?>" size="10" /></td>
                </tr>
              </table></td>
              </tr>
            <tr>
              <td colspan="5" class="welcomexx"><input name="dollarRate" type="hidden" id="dollarRate" value="<?php echo $rate; ?>" /></td>
              <td class="welcomexx"><input name="Submit" type="submit" class="goZ" value="&raquo; &raquo; Process Invoice" /></td>
            </tr>
          </table>
          </form>

Next is to Print a copy and also send a copy into the DB which i do with

<?php 
//Get Client Details
$name = $_POST['name'];
$address = $_POST['address'];
$date = $_POST['firstinput'];
//Get Codes
$select1 = $_POST['select1'];
$select2 = $_POST['select2'];
$select3 = $_POST['select3'];
$select4 = $_POST['select4'];
$select5 = $_POST['select5'];
$select6 = $_POST['select6'];
$select7 = $_POST['select7'];
$select8 = $_POST['select8'];
$select9 = $_POST['select9'];
$select10 = $_POST['select10'];
$select11 = $_POST['select11'];
$select12 = $_POST['select12'];
$select13 = $_POST['select13'];
$select14 = $_POST['select14'];
$select15 = $_POST['select15'];

//Get Products
$product1 = $_POST['product1'];
$product2 = $_POST['product2'];
$product3 = $_POST['product3'];
$product4 = $_POST['product4'];
$product5 = $_POST['product5'];
$product6 = $_POST['product6'];
$product7 = $_POST['product7'];
$product8 = $_POST['product8'];
$product9 = $_POST['product9'];
$product10 = $_POST['product10'];
$product11 = $_POST['product11'];
$product12 = $_POST['product12'];
$product13 = $_POST['product13'];
$product14 = $_POST['product14'];
$product15 = $_POST['product15'];

//Get Prices
$price1 = $_POST['price1'];
$price2 = $_POST['price2'];
$price3 = $_POST['price3'];
$price4 = $_POST['price4'];
$price5 = $_POST['price5'];
$price6 = $_POST['price6'];
$price7 = $_POST['price7'];
$price8 = $_POST['price8'];
$price9 = $_POST['price9'];
$price10 = $_POST['price10'];
$price11 = $_POST['price11'];
$price12 = $_POST['price12'];
$price13 = $_POST['price13'];
$price14 = $_POST['price14'];
$price15 = $_POST['price15'];

//Get Quantity
$qty1 = $_POST['qty1'];
$qty2 = $_POST['qty2'];
$qty3 = $_POST['qty3'];
$qty4 = $_POST['qty4'];
$qty5 = $_POST['qty5'];
$qty6 = $_POST['qty6'];
$qty7 = $_POST['qty7'];
$qty8 = $_POST['qty8'];
$qty9 = $_POST['qty9'];
$qty10 = $_POST['qty10'];
$qty11 = $_POST['qty11'];
$qty12 = $_POST['qty12'];
$qty13 = $_POST['qty13'];
$qty14 = $_POST['qty14'];
$qty15 = $_POST['qty15'];

//Get Amount
$amt1 = $_POST['amt1'];
$amt2 = $_POST['amt2'];
$amt3 = $_POST['amt3'];
$amt4 = $_POST['amt4'];
$amt5 = $_POST['amt5'];
$amt6 = $_POST['amt6'];
$amt7 = $_POST['amt7'];
$amt8 = $_POST['amt8'];
$amt9 = $_POST['amt9'];
$amt10 = $_POST['amt10'];
$amt11 = $_POST['amt11'];
$amt12 = $_POST['amt12'];
$amt13 = $_POST['amt13'];
$amt14 = $_POST['amt14'];
$amt15 = $_POST['amt15'];
$totalNaira=$amt1+$amt2+$amt3+$amt4+$amt5+$amt6+$amt7+$amt8+$amt9+$amt10+$amt11+$amt12+$amt13+$amt14+$amt15;
$totalDollar=$totalNaira/$rate;
?>

<?php
mysql_select_db($database_tSaturnConn, $tSaturnConn);
$sql="INSERT INTO litorder (name, address, xdate, code1, code2, code3, code4, code5, code6, code7, code8, code9, code10, code11, code12, code13, code14, code15, product1, product2, product3, product4, product5, product6, product7, product8, product9, product10, product11, product12, product13, product14, product15, price1, price2, price3, price4, price5, price6, price7, price8, price9, price10, price11, price12, price13, price14, price15, quantity1, quantity2, quantity3, quantity4, quantity5, quantity6, quantity7, quantity8, quantity9, quantity10, quantity11, quantity12, quantity13, quantity14, quantity15, amount1, amount2, amount3, amount4, amount5, amount6, amount7, amount8, amount9, amount10, amount11, amount12, amount13, amount14, amount15, totalNaira, totalDollar) VALUES ('$name', '$address',  '$date', '$select1', '$select2', '$select3', '$select4', '$select5', '$select6', '$select7', '$select8', '$select9','$select10', '$select11', '$select12', '$select13', '$select14', '$select15', '$product1', '$product2', '$product3', '$product4', '$product5', '$product6', '$product7', '$product8', '$product9','$product10', '$product11', '$product12', '$product13', '$product14', '$product15', '$price1', '$price2', '$price3', '$price4', '$price5', '$price6', '$price7', '$price8', '$price9','$price10', '$price11', '$price12', '$price13', '$price14', '$price15', '$qty1', '$qty2', '$qty3', '$qty4', '$qty5', '$qty6', '$qty7', '$qty8', '$qty9','$qty10', '$qty11', '$qty12', '$qty13', '$qty14', '$qty15', '$amt1', '$amt2', '$amt3', '$amt4', '$amt5', '$amt6', '$amt7', '$amt8', '$amt9','$amt10', '$amt11', '$amt12', '$amt13', '$amt14', '$amt15', '$totalNaira',  '$totalDollar')";

if (!mysql_query($sql,$tSaturnConn))
  {
  die('Error: ' . mysql_error());
  }
mysql_close($tSaturnConn)
?>

thanks for ur support

0

You need to scrap your ENTIRE code!

Try looking at using loops to generate the table output.
I'd also recommend only letting users enter ONE item at a time. This will remove the need for possibly empty rows.

Have a go at using the tips provided yourself. Because to be honest, i've stopped using PHP a long time ago, and dont remember most of it. =D

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.