Click here to Skip to main content
15,885,366 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: Tool to test webpage Pin
Rajdev Ramasamy12-Jan-09 2:32
Rajdev Ramasamy12-Jan-09 2:32 
QuestionHaving problems with unit testing a web service Pin
Rafferty Uy29-Dec-08 20:12
Rafferty Uy29-Dec-08 20:12 
AnswerRe: Having problems with unit testing a web service Pin
Abhijit Jana1-Jan-09 0:10
professionalAbhijit Jana1-Jan-09 0:10 
GeneralRe: Having problems with unit testing a web service Pin
Rafferty Uy1-Jan-09 14:40
Rafferty Uy1-Jan-09 14:40 
QuestionOpen Crystal report using Javascript. Pin
Chinzac29-Dec-08 16:21
Chinzac29-Dec-08 16:21 
QuestionCrystal Report Viewer Pin
Civic0629-Dec-08 7:40
Civic0629-Dec-08 7:40 
AnswerRe: Crystal Report Viewer Pin
Not Active29-Dec-08 11:01
mentorNot Active29-Dec-08 11:01 
Questionhow to store values from dynamically added rows into database Pin
manojramakrishnan29-Dec-08 0:24
manojramakrishnan29-Dec-08 0:24 
hi to all,

i have faced a problem in storing the values in the textfield created dynamically by clicking a button. the insert query in the code stores only the first value in the array that is the value from default textfield in the form not the dynamically created ones.


I am using the code:

<?php
$con=mysql_connect("localhost","root","");
mysql_select_db("db_name",$con);
if($_POST["Submit"]=='Submit')
{$comments=$_POST["comm"];
$row=$_POST["file"];
$result=implode(",",$row);


$sql=mysql_query("insert into tablename(fieldname)VALUES('$result','$comments')");
}
?>

<html>
<script language="JavaScript">
var glob;
glob = 1;
function insert_row(tablename)
{

var the_table = document.getElementById(tablename);
var new_row_index = the_table.rows.length;
glob = glob + 1;
the_table.insertRow(new_row_index);
the_table.rows[new_row_index].insertCell(0);
the_table.rows[new_row_index].cells[0].innerHTML =(the_table.rows[0].innerHTML);
}

function removeRowFromTable(tblSample)
{
var tbl = document.getElementById(tblSample);
var lastRow = tbl.rows.length;
if (lastRow > 1) tbl.deleteRow(lastRow - 1);
}



function removeRowFromTable(tblSample)
{
var tbl = document.getElementById(tblSample);
var lastRow = tbl.rows.length;
if (lastRow > 1) tbl.deleteRow(lastRow - 1);
}
function validateRow(frm)
{
var chkb = document.getElementById('chkValidate');
if (chkb.checked) {
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length - 1;
var i;
for (i=1; i<=lastRow; i++) {
var aRow = document.getElementById('txtRow' + i);
if (aRow.value.length <= 0) {
alert('Row ' + i + ' is empty');
return false;
}
}
}
openInNewWindow(frm);
}
</script>



<body bgcolor="#009900">
<form action="index.php" method="post" onSubmit=" return validateRow(this.form);" >


<table width="100%" border="0" cellpadding="0" cellspacing="0" class="maintxt" id="product">
<tr>

<td >Text Field: <span style="color:red">*</span><br />
<input name="file[]" type="text" class="Textfield" id="prod_image[]" size="42" style="border:1px solid #c2c2c2"/></td>
</tr>
<tr>
<td height="24" colspan="2" align="right" ><input name="increment" type="button" class="mtxt" id="increment" onClick="insert_row('product')" value="Add"/>
<input name="decrement" type="button" class="mtxt" id="decrement" onClick="removeRowFromTable('product')" value="Remove"/></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
</table>

<p> Comments:
<input type="text" name="comm">
</p>
<p>
<input type="submit" value="Submit" name="Submit" />
</p>



</form>
</body>
</html>


can anybody help me?pls i need it urgently

manoj
AnswerRe: how to store values from dynamically added rows into database Pin
Girish Nambiar2-Jan-09 0:29
Girish Nambiar2-Jan-09 0:29 
Questionmakinng code visible and invisible using javascript Pin
nainakarri27-Dec-08 2:50
nainakarri27-Dec-08 2:50 
AnswerRe: makinng code visible and invisible using javascript Pin
Guffa27-Dec-08 4:05
Guffa27-Dec-08 4:05 
AnswerRe: makinng code visible and invisible using javascript Pin
Aman Bhullar27-Dec-08 6:04
Aman Bhullar27-Dec-08 6:04 
GeneralRe: makinng code visible and invisible using javascript Pin
nainakarri29-Dec-08 17:08
nainakarri29-Dec-08 17:08 
Questionusing jmesa Pin
axecutioner26-Dec-08 20:43
axecutioner26-Dec-08 20:43 
QuestionSharePoint Desinger and SQL Server 2008 Pin
Not Active26-Dec-08 19:22
mentorNot Active26-Dec-08 19:22 
Questionhow to read images from mobile photo gallery using javascript Pin
revathi_srikrishna26-Dec-08 18:14
revathi_srikrishna26-Dec-08 18:14 
QuestionVirtual Brochure Pin
BRIMID26-Dec-08 14:16
BRIMID26-Dec-08 14:16 
QuestionJSP code execute Pin
kavitaBC26-Dec-08 0:09
kavitaBC26-Dec-08 0:09 
Generalajax+menu [modified] Pin
Ramkumar_S25-Dec-08 21:44
Ramkumar_S25-Dec-08 21:44 
GeneralRe: ajax+menu Pin
Not Active26-Dec-08 3:22
mentorNot Active26-Dec-08 3:22 
QuestionRequest for advice on technology selection! Pin
Member 302239925-Dec-08 7:40
Member 302239925-Dec-08 7:40 
AnswerRe: Request for advice on technology selection! Pin
Not Active25-Dec-08 12:39
mentorNot Active25-Dec-08 12:39 
AnswerRe: Request for advice on technology selection! Pin
Aman Bhullar25-Dec-08 18:02
Aman Bhullar25-Dec-08 18:02 
AnswerRe: Request for advice on technology selection! Pin
Member 302239925-Dec-08 22:45
Member 302239925-Dec-08 22:45 
QuestionAutomatic prompting for file downloads ---- postback problem Pin
deepakwaje24-Dec-08 0:56
deepakwaje24-Dec-08 0:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.