popmotsy Posted July 10, 2009 Share Posted July 10, 2009 hi,,, I want on submit button all textbox values insert into Table1, row wise. but I dont understand how i write code for this,can anyone help. please see the code. <?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> </TR> <tr> <td width="16%" ><input type="text" name="cid0" size="16" tabindex="1" onkeypress="handleKeyPress(event,this,id);" ></td> </tr> <tr> <td width="16%"><input type="text" name="cid1" size="16" tabindex="2" onkeypress="handleKeyPress(event,this,id);" ></td> </tr> <tr> <td width="16%"><input type="text" name="cid2" size="16" tabindex="3" onkeypress="handleKeyPress(event,this,id);" ></td> </tr> <tr> <td width="16%"><input type="text" name="cid3" size="16" tabindex="4" onkeypress="handleKeyPress(event,this,id);" ></td> </tr> <tr> <td width="16%"><input type="text" name="cid4" size="16" tabindex="5" onkeypress="handleKeyPress(event,this,id);" ></td> </tr> <tr> <td width="16%"><input type="text" name="cid5" size="16" tabindex="6" onkeypress="handleKeyPress(event,this,id);" ></td> </tr> <tr> <td width="16%"><input type="text" name="cid6" size="16" tabindex="7" onkeypress="handleKeyPress(event,this,id);" ></td> </tr> </TABLE> <input type="submit" value="Submit"> </form> </td> </tr> </table> <?php require_once("include/right.php"); ?> <?php require_once("include/footer.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/165451-inserting-values/ Share on other sites More sharing options...
ignace Posted July 10, 2009 Share Posted July 10, 2009 Read the manual! <?php if (!empty($_POST)) { $column1 = $_POST['column1']; //.. $query = 'INSERT INTO table VALUES (\'%s\')'; $fquery = sprintf($query, $column1); mysql_query($fquery, $db); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/165451-inserting-values/#findComment-872628 Share on other sites More sharing options...
popmotsy Posted July 10, 2009 Author Share Posted July 10, 2009 hi ignace.. this code works...fine....thanks for ur help... thanks Quote Link to comment https://forums.phpfreaks.com/topic/165451-inserting-values/#findComment-872656 Share on other sites More sharing options...
popmotsy Posted July 10, 2009 Author Share Posted July 10, 2009 but this code workin If i use checkbox instead of textboxex.... I want selected value insert into database.... Quote Link to comment https://forums.phpfreaks.com/topic/165451-inserting-values/#findComment-872657 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.