popmotsy Posted July 8, 2009 Share Posted July 8, 2009 Hii to all, I make a data entry page in which user can enter 50 records at a time, I want ,on submit, records insert into table row wise, but I dont know how to write code for this, here is code for making data entry page,, <?php ob_start();?> <?php include("include/connection.php"); ?> <?php include("include/header.php"); ?> <script type="text/javascript" > function handleKeyPress(e,fldobj,nbox) { var key=e.keyCode || e.which; if (key==13) { event.cancelBubble = true; //Both lines stops auto submistion event.returnValue = false; // by pressing ENTER (submit) button //alert (nbox); var next=fldobj.tabIndex; // this will grap the tabindex of the object passed to variable 'next' //alert (next); //alert (next); var nN='cid'; // 'nN' is a placeholder for storing the lable of first field 'cid' nN=nN+next; // now both var concatinates for the creation of final text box name like 'cid0' 'cid1' //alert (nN); document.myform.elements[nN].focus(); // it will rotet the focus to the next element (textbox) } } </SCRIPT> <?php require_once("include/top.php"); ?> <?php require_once("include/left.php"); ?> <table align="center"><th align="center"> POD Entries</th></table> <table border="0" width="100%"> <TR> <TD width="100%" align="center"> <form name="myform" method="post" action="validpod.php" > <table align="center" border="1" style="font-size:12"> <TR> <th align="center" >Barcode No</th> <th align="center" >POD No.</th> <th align="center" >Received By</th> <th align="center" >Relation </th> <th align="center" >Delivery Boy</th> <th align="center" ><b>Delivery Date</th> <th>Executive Code</th> <th>Remark</th> </TR> <TR> <TD > </TD> <TD > </TD> <TD > </TD> <TD > </TD> <TD > </TD> <TD > </TD> <TD > </TD> <TD > </TD> </TR> <tr> <td width="16%" ><input type="text" name="cid0" size="16" tabindex="1" onkeypress="handleKeyPress(event,this,id);" ></td> <td width="17%"><input type="text" name="podno0" value="218" tabindex="50" size="17"></td> <td width="17%"><input type="text" name="recdby0" tabindex="100" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="relation0" tabindex="150" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="delvryboy0" tabindex="200" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="deliverydate0" tabindex="250" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="execode0" tabindex="300" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="remark0" tabindex="350" size="17" autocomplete="array:autodata"></td> </tr> <tr> <td width="16%"><input type="text" name="cid1" size="16" tabindex="2" onkeypress="handleKeyPress(event,this,id);" ></td> <td width="17%"><input type="text" name="podno1" value="219" tabindex="51" size="17"></td> <td width="17%"><input type="text" name="recdby1" tabindex="101" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="relation1" tabindex="151" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="delvryboy1" tabindex="201" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="deliverydate1" tabindex="251" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="execode1" tabindex="301" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="remark1" tabindex="351" size="17" autocomplete="array:autodata"></td> </tr> <tr> <td width="16%"><input type="text" name="cid2" size="16" tabindex="3" onkeypress="handleKeyPress(event,this,id);" ></td> <td width="17%"><input type="text" name="podno2" value="220" tabindex="52" size="17"></td> <td width="17%"><input type="text" name="recdby2" tabindex="102" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="relation2" tabindex="152" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="delvryboy2" tabindex="202" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="deliverydate2" tabindex="252" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="execode2" tabindex="302" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="remark2" tabindex="352" size="17" autocomplete="array:autodata"></td> </tr> <tr> <td width="16%"><input type="text" name="cid3" size="16" tabindex="4" onkeypress="handleKeyPress(event,this,id);" ></td> <td width="17%"><input type="text" name="podno3" value="221" tabindex="53" size="17"></td> <td width="17%"><input type="text" name="recdby3" tabindex="103" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="relation3" tabindex="153" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="delvryboy3" tabindex="203" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="deliverydate3" tabindex="253" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="execode3" tabindex="303" size="17" autocomplete="array:autodata"></td> <td width="17%"><input type="text" name="remark3" tabindex="353" size="17" autocomplete="array:autodata"></td> </tr> ''' ' ' ' ' ' ' ''' ' ' up to 50 <tr> <td width="20%"><input type="text" name="total_inputs" value="50" size="20"></td> </tr> </TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE> <input type="submit" value="Submit"> </form> </td> </tr> </table> <?php require_once("include/right.php"); ?> <?php require_once("include/footer.php"); ?> how I can insert in to database.. here "podno" is auotincrement, Quote Link to comment https://forums.phpfreaks.com/topic/165157-insert-row-wise/ Share on other sites More sharing options...
ignace Posted July 8, 2009 Share Posted July 8, 2009 if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST)) { ..variables.. $query = 'INSERT INTO tabel (column(n), column(n+1), ..) VALUES ($_POST[n], $_POST[n+1], ..)'; mysql_query($query); } Quote Link to comment https://forums.phpfreaks.com/topic/165157-insert-row-wise/#findComment-870857 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.