I am new and learning php. please, help me to solve this... i want to genarate a field in form of HTML, whin a button is click. and also send those data to the page(WHERE php code available), when submit button is click.... for also sql quary.... here is the html code: <body> <form action="pro_price3.php" method="post"> <div id='row1'> pro_id: <input type="varchar" name ="pro_id" /> | <a href='#' onclick="insertElementAfter(document.createElement('input'), this);"> add another field!<a><br/> </div> <script type="text/javascript"> function insertElementAfter(newElement, targetElement) { var parent = targetElement.parentNode; if(parent.lastchild == targetElement) { parent.appendChild(newElement); } else { parent.insertBefore(newElement, targetElement.nextSibling); } } </script> <input type="submit"/> </form> </body> for this php code is :--------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------ here, in my test sql database, there is a three field namely, pro_name,pro_id, price, i want to count total price.... <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } echo "<body style = 'background-color:#700000'> "; mysql_select_db("test", $con); $pro_id = $_POST['pro_id']; $result = mysql_query("SELECT * FROM product_information WHERE pro_id = $pro_id[0] || pro_id = $pro_id[1] || pro_id = $pro_id[2]|| pro_id = $pro_id[3]"); echo "<table border='1' width = '520' align ='center' style = 'background-color:#FFA500'> <tr> <th>pro_name</th> <th>pro_id</th> <th> price </th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['pro_name'] . "</td>"; echo "<td>" . $row['pro_id'] . "</td>"; echo "<td>" . $row['price'] . "</td>"; echo "</tr>"; } echo "</table>"; $result2 = mysql_query("SELECT price FROM product_information WHERE pro_id = $pro_id[0] || pro_id = $pro_id[1] || pro_id = $pro_id[2]|| pro_id = $pro_id[3]"); $total = $result2[0] + $result2[1] +$result2[2] + $result2[3] ; echo $total; echo "</body>"; ?>