Jump to content

Why am I not seeing javascript made fields?


ram4nd

Recommended Posts

Why am I not seeing javascript made fields?

<?php
static $body;
if(isset($_POST['saada']))

if(isset($_POST['text1_0'])) echo $_POST['text1_0'];
if(isset($_POST['text1_1'])) echo $_POST['text1_1'];
if(isset($_POST['text1_2'])) echo $_POST['text1_2'];

if(!isset($_POST['saada']))
$body = '<script type="text/javascript">
<!--
function lisa_rida()
{
var tabel = document.getElementById(\'tabel\');
var last_row = tabel.rows.length;
var iteration = last_row;
var row = tabel.insertRow(last_row);

form_1.rows.value = 1 + iteration;

//Cell 1
var text_box_1 = document.createElement(\'input\');
text_box_1.type = \'text\';
var cell_1 = row.insertCell(0);
text_box_1.name = \'text1_\' + iteration;
cell_1.appendChild(text_box_1);
//Cell 2
var text_box_2 = document.createElement(\'input\');
text_box_2.type = \'text\';
var cell_2 = row.insertCell(1);
text_box_2.name = \'text2_\' + iteration;
cell_2.appendChild(text_box_2);
//Cell 3
var text_box_3 = document.createElement(\'input\');
text_box_3.type = \'text\';
var cell_3 = row.insertCell(2);
text_box_3.name = \'text3_\' + iteration;
cell_3.appendChild(text_box_3);
//Cell 4
var text_box_4 = document.createElement(\'input\');
text_box_4.type = \'text\';
var cell_4 = row.insertCell(3);
text_box_4.name = \'text4_\' + iteration;
cell_4.appendChild(text_box_4);
}
//-->
</script>
<table border="0" id="tabel"><form action="'.$_SERVER['PHP_SELF'].'" method="post" id="form_1">
<tr>
<td><input type="text" name="text1_0" /></td>
<td><input type="text" name="text2_0" /></td>
<td><input type="text" name="text3_0" /></td>
<td><input type="text" name="text4_0" /></td>
</tr>
</table>
<input type="hidden" id="rows" name="rows" value="1" />

<input type="button" value="Lisa rida" onclick="lisa_rida();" />
<input type="submit" value="Saada" name="saada" />
</form>';
echo $body;
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.