Jump to content
php.lv forumi
  • 0

create Input


Question

Posted (edited)

Tātad ir lauks kur ir input'i, kad uzspiež uz Add input pievienojas input. Bet kad vajag to input vērtību ielikt DB, viņš nenolasa pievienotos laukums. Kā to var izlabot, lai mysql_query varētu izlasīt?

 

kods


function display() {
 document.getElementById('parah').innerHTML="";
 for (intI=2;intI<arrInput.length;intI++) {
   document.getElementById('parah').innerHTML+=createInput(arrInput[intI], arrInputValue[intI]);
 }
}



function createInput(id,value) {
   for (i=0;i<2;i++) {
 	return "<p id='heh"+ id +"'>"+ id +". <input type='text' name='textBox"+ id +"' id='textBox"+ id +"' onChange='javascript:saveValue("+ id +",this.value)' value='"+ value +"' size='20'> <a href='javascript:;' onclick='javascript:delIn(\"heh"+ id +"\");'>del</a></p>";

}
}

Edited by chizijs

5 answers to this question

Recommended Posts

  • 0
Posted

Parasts insert kods

$a1 = $_POST['textBox1'];
$a2 = $_POST['textBox2'];
$a3 = $_POST['textBox3'];
$a4 = $_POST['textBox4'];
$a5 = $_POST['textBox5'];
 mysql_query("INSERT INTO `tabula`(`a1`, `a2`, `a3`, `a4`, `a5`) VALUES('$a1', '$a2',  '$a3', '$a4', '$a5')") or die(mysql_error());

 

p.s source code (CTRL+U) arī kad ir pievienoti laukumi rada tikai <div id="parah"></div>

  • 0
Posted

Uztaisi...

 

<input type="text" name="njemam[]" />

 

Un tad, PHP pusē...

 

forEach( $njemam as $input ) {

 // ...

}

Guest
This topic is now closed to further replies.
×
×
  • Create New...