par
KINGSBEST » 06 déc. 2006, 22:50
Bonjour, je voudrais rajouter une ligne d'un tableau contenant un champ dans un formulaire en cliquent sur un bouton formations supplémentaires.
J'ai un fichier formbis.js d'un part:
Code : Tout sélectionner
function ajouterformation(){
var s=document.getElementById("hid");
var x=parseInt(s.value)+1;
s.value=x;
var formation=document.getElementById("formations");
formation.innerHTML=formation.innerHTML+"<tr><td width=\"9%\">Année :</td>
<td><input type=\"text\" name=\"annee\" value=\"$annee\" size=\"4\"/> </td>
</tr>";
}
et d'autre part, un fichier php:
<?php
session_start();
?>
<?php
echo "
<html>
<head>
</head>
<body bgcolor=\"#f6f6f6\">
<form enctype=\"multipart/form-data\" method=POST action=\"pageDcompetences.php\">
<table width=\"100%\" border=\"1\">
<div id=\"formations\">
<input type=\"hidden\" value=\"1\" id=\"hid\">
<tr>
<td width=\"12%\"></td>
<td width=\"76%\" bgcolor=\"#ffffcc\" border=\"1\">
<table width=\"100%\" border=\"1\">
<tr>
<br>
</tr>
<tr>
<td width=\"100%\">
<table width=\"100%\">
<tr height=\"40\">
<td >Année :</td>
<td ><input type=\"text\" name=\"annee\" value=\"$annee\" size=\"4\"/> </td>
</tr>
</table>
</td>
</tr>
</td>
</tr>
</div>
<tr>
<td><input type=\"button\" value=\"Formation suppl.\" onClick=\"ajouterformation()\"/></td>
</tr>
<tr>
<td align=\"right\">
<input type=\"submit\" value=\"Continuez\">
</form>
</table>
</body>
</html>";
?>
Mon pb est que je voudrais rajouter le champs annee2 dans une nouvelle ligne de mon tableau. et ça ne marche pas...
est ce que qq un peut m'aider?
Bonjour, je voudrais rajouter une ligne d'un tableau contenant un champ dans un formulaire en cliquent sur un bouton formations supplémentaires.
J'ai un fichier formbis.js d'un part:
[code]function ajouterformation(){
var s=document.getElementById("hid");
var x=parseInt(s.value)+1;
s.value=x;
var formation=document.getElementById("formations");
formation.innerHTML=formation.innerHTML+"<tr><td width=\"9%\">Année :</td>
<td><input type=\"text\" name=\"annee\" value=\"$annee\" size=\"4\"/> </td>
</tr>";
}[/code]
et d'autre part, un fichier php:
[php]<?php
session_start();
?>[/php]
[code]<script type="text/javascript" src="formbis.js">
</script>[/code]
[php]
<?php
echo "
<html>
<head>
</head>
<body bgcolor=\"#f6f6f6\">
<form enctype=\"multipart/form-data\" method=POST action=\"pageDcompetences.php\">
<table width=\"100%\" border=\"1\">
<div id=\"formations\">
<input type=\"hidden\" value=\"1\" id=\"hid\">
<tr>
<td width=\"12%\"></td>
<td width=\"76%\" bgcolor=\"#ffffcc\" border=\"1\">
<table width=\"100%\" border=\"1\">
<tr>
<br>
</tr>
<tr>
<td width=\"100%\">
<table width=\"100%\">
<tr height=\"40\">
<td >Année :</td>
<td ><input type=\"text\" name=\"annee\" value=\"$annee\" size=\"4\"/> </td>
</tr>
</table>
</td>
</tr>
</td>
</tr>
</div>
<tr>
<td><input type=\"button\" value=\"Formation suppl.\" onClick=\"ajouterformation()\"/></td>
</tr>
<tr>
<td align=\"right\">
<input type=\"submit\" value=\"Continuez\">
</form>
</table>
</body>
</html>";
?>[/php]
Mon pb est que je voudrais rajouter le champs annee2 dans une nouvelle ligne de mon tableau. et ça ne marche pas...
est ce que qq un peut m'aider?