1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Web Template - Web 2.0!</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body,td,th {
font-size: xx-large;
}
-->
</style>
<script language="javascript" src="jquery.js">
</script>
<script language="javascript">
function okaj()
{
if(document.getElementById('nom').value==''|| document.getElementById('prenom').value=='')
{
alert('IL faut remplir tous les champs textes');
}
else
{
<?php
$host="localhost";
$user = "root";
$bdd = "test";
$passwd = "";
// Connexion au serveur
mysql_connect($host, $user,$passwd) or die("erreur de connexion au serveur");
mysql_select_db($bdd) or die("erreur de connexion a la base de donnees");
// Creation et envoi de la requete
$query = "INSERT INTO `test` ( `nom` ) VALUES ('yassine')";
$result = mysql_query($query);
?>
}
}
</script>
</head>
<body>
<table width="429" border="1">
<tr>
<td width="190">Nom:</td>
<td width="223"><input type="text" name="nom" /> </td>
</tr>
<tr>
<td>Prenom:</td>
<td><input type="text" name="prenom" /> </td>
</tr>
<tr>
<td>Mot de passe: </td>
<td><input type="password" name="password" /> </td>
</tr>
<tr>
<td>Adresse:</td>
<td><input type="text" name="adresse" /> </td>
</tr>
<tr>
<td> </td>
<td><input type="button" OnClick="okaj()" value="Ajouter"/> </td>
</tr>
</table>
</body>
</html> |
Partager