[eluser]Unknown[/eluser]
Hallo,
I just made a form with addRow function. (my first form with javascript)
see image
de code
Code:
<?php
require "db.php";
$query= "SELECT * FROM taallessen ORDER BY taalnaam ASC";
$res = mysql_query($query) or die(mysql_error());
$lesdata = "";
while ($row = mysql_fetch_row($res)){
if ($lesdata)
$lesdata .= ",";
$lesdata .= '"'.$row[1].'"';
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Join now</title>
<link href="main.css" type="text/css" rel="stylesheet">
</head>
[removed]
function del_formrow(){
if (!this.table_formcontainer)
this.table_formcontainer = document.getElementById("table_formcontainer");
if (!this.table_formcontainer)
return;
var table_formcontainer = document.getElementById("table_formcontainer")
if (table_formcontainer.rows.length > 1)
{
table_formcontainer.deleteRow(table_formcontainer.rows.length-1);
}
table_formcontainer.deleteRow();
}
function add_formrow(){
if (!this.table_formcontainer)
this.table_formcontainer = document.getElementById("table_formcontainer");
if (!this.table_formcontainer)
return;
var new_row = table_formcontainer.insertRow(-1);
var new_cell1 = new_row.insertCell(0);
var new_cell2 = new_row.insertCell(1);
var new_cell3 = new_row.insertCell(2);
var new_input1 = document.createElement("input");
new_input1.type = "text";
new_input1.size = "40";
new_input1.name = "kidername[]";
new_cell1.appendChild(new_input1);
var new_input2 = document.createElement("input");
new_input2.type = "text";
new_input2.size = "5";
new_input2.name = "age[]";
new_cell2.appendChild(new_input2);
var new_input3 = document.createElement("select");
new_input3.name="lesson[]";
var options = [<?php echo $lesdata; ?>] ;
for (var i = 0; i < options.length; i++)
{
var option = document.createElement("option");
option.value = options[i];
option.text= options[i];
try
{
new_input3.add(option, null);
}
catch(error)
{
new_input3.add(option);
}
}
new_cell3.appendChild(new_input3);
}
[removed]
<body>
<div id="credit"><b>T e s t</b></div>
<br>
<form name="data" method="post" action="confirmation.php">
<fieldset> <legend>
<font color="blue"><b>Kid informations</b></font></legend><br>
<table id="table_formcontainer">
<tr bgcolor="#e5e5e5">
<td width="200"> Kidname </td> <td width="20"> Age </td> <td width="80"> Lesson </td>
</tr>
<tr>
<td><input name="kidname[]" size="40"></td> <td><input name="age[]" size="5"></td>
<td><select name="lesson[]"><option value="select">select</option><option>Chines</option>
<option>German</option><option>France</option><option>English</option><option>Italian</option>
<option>Nederlands</option><option>Spain</option></select></td>
</tr>
</table>
<table>
<tr>
<td width="500" align="right">[<b><a href="#">+</a></b>]</td>
<td> </td><td>[<b><a href="#">-</a></b>]</td>
</tr>
</table>
<br>
<fieldset> <legend>
<font color="blue"><b>Parent informations</b></font></legend><br>
<table>
<tr>
<td width="100">Name</td> <td>:</td> <td><input name="naam" size="50"></td>
</tr>
<tr>
<td width="100">Address</td> <td>:</td> <td><input name="adres" size="50"></td>
</tr>
<tr>
<td width="100">Zip</td> <td>:</td> <td><input name="postcode" size="50"></td>
</tr>
<tr>
<td width="100">City</td> <td>:</td> <td><input name="woonplaats" size="50"></td>
</tr>
<tr>
<td width="100">Phone</td> <td>:</td> <td><input name="telefoon" size="50"></td>
</tr>
<tr>
<td width="100">Email</td> <td>:</td> <td><input name="email" size="50"></td>
</tr>
</table>
<table>
<tr>
<td width="100"> </td> <td> </td>
<td><br><input type="submit" name="submit" value=" C o n f i r m ">
<input type="button" value=" R e s e t "></td>
</tr>
</table>
</form></fieldset>
<br>
</body>
</html>
My question is how to send this form using php?
perhaps someone can help me. thanks in advance