PHP et fonction javascript
Bonjour à tous,
j'ai un souci avec une fonction sur un formulaire
j'ai un fichier qui s'appelle "client-search.php" et "client-delete.php". J'utilise un fonction qui s'appelle effacement en javascript.
j'affiche ma liste de client :
Code:
1 2 3 4 5 6 7 8 9 10 11
| while( $req = mysql_fetch_assoc($sql))
{
$num = $req['NUM_CLIENT'];
$nom = $req['NOM'];
$prenom = $req['PRENOM'];
echo "<tr>";
echo "<td width='300'>$nom $prenom</td>";
echo "<td width='30'><a href='client-update.php?num=$num' title='Information' ><img src='icones/modifier.gif' width='20' height='20' border='0'></a></td>";
echo "<td width='30'><a href='javascript:effacement($num);' title='Supprimer'><img src='icones/supprimer.gif' width='20' height='20' border='0'></a></td>";
echo "</tr>";
} |
ma fonction effacement est entre les balise <head>
Code:
1 2 3 4 5 6 7
| <script language="JavaScript" type="text/JavaScript">
function effacement(id)
{
if (confirm(" Etes-vous sûr de vouloir supprimer ce client?\n" ))
document.location = "client-delete.php?id=" + id;
}
</script> |
Si je passe un chiffre la fonction marche et si c'est une chaine de caractère ça ne marche pas. Quelqu'un peut il m'aider ?
Merci