|
|
|
|
Posté par
Pascal_22, le mercredi 18 juillet 2007 à 02:01:01
<html>
<head><title>Connexion à Mysql</title></head>
<body>
<?php
function AjoutNote()
{
echo "<h1>dedans la sub</h1>";
}
function AfficherNoteS()
{
$cn=mysql_connect("localhost","root","");
if(!$cn)
{
echo "Impossible de se connecter : " . mysql_error();
}
$db_Inventaire=mysql_select_db('Inventaire',$cn);
if(!$db_Inventaire)
{
echo "Impossible d\'utiliser la base : " . mysql_error();
}
$query="select * from Notes";
$result=mysql_query($query);
$nb=mysql_numrows($result);
$i=0;
echo "<table width=100% border=2>";
while ($i<$nb)
{
echo "<tr>";
echo "<td>";
$note=mysql_result($result,$i,"DescNote");
echo "La Note No " . ($i+1) . " " . $note;
$i++;
echo "</td>";
echo "</tr>";
}
echo "</table>";
}
?>
<form>
<button type="submit" name="btAdd" value="Ajouter une Note" onclick="AjoutNote();">Ajouter une Note</button>
<button type="button" name="btAfficher" value="Afficher les Notes" onclick="<? AfficherNoteS() ?>">Afficher les Notes</button>
</form>
</body>
</html>
Car je veux éviter d'avoir 2 pages web de plus (ajout.php et afficher.php) !! Est-ce possible d'arranger le tout mais sur une seul page PHP ??
Si quelqu'un pourrait me donne un conseil cela serais bien apprécier !!
Merci Beaucoup !
Pascal_22
Configuration: Windows XP Internet Explorer 7.0
Bonjour,
Comme php agit UNIQUEMENT coté serveur il est impossible d'utilisé que php pour cela. On peut utiliser ajax: Un petit tutorial: http://www.xul.fr/xml-ajax.html |
| 27/03 16h03 | [PHP] Méthodes de débogage | PHP |
| 06/11 19h24 | [PHP] Upload de fichiers | PHP |
| 31/07 23h21 | [PHP] Headers already sent by..... | PHP |
| 20/04 18h59 | [PHP] Fonction mail() | PHP |
| 27/10 00h37 | [PHP] Les ressemblances à ne pas confondre | PHP |
| 11/07 13h10 | Appel fonction PHP | 7 |
| 11/06 08h15 | Appel fonction JavaScript en PHP (pb guilmet) | 3 |
| 19/04 22h35 | Comment faire pour appeler un fonction php | 1 |
| 28/02 17h57 | [PHPBB] Bouton appelant une fonction php | 0 |
![]() | PHP Edit - PHPEdit est un environnement de développement intégré (IDE) sous Windows pour le langage PHP. Il offre un grand nombre de... | Catégorie: PHP Licence: Freeware/gratuit |
![]() | WAMP Server - WAMP5 (WAMP signifiant Windows Apache Mysql PHP) est une plateforme de développement Web sous Windows. Il vous permet de... | Catégorie: Serveurs Licence: Freeware/gratuit |
![]() | PSPad - PSPad est un excellent éditeur de texte. Il est utile pour travailler sur du simple texte, mais aussi sur du HTML, CSS,... | Catégorie: Développement Licence: Freeware/gratuit |
![]() | Jedit - Editeur de texte capable de supporter la majeure partie des langages de programmation (perl,java,php,c,asp, etc.) et... | Catégorie: Développement Licence: Open Source |
![]() | LabTec 3 Button Mouse | Catégorie: Souris | 4.18 € Cdiscount |
![]() | IBM Optical 3-Button Travel | Catégorie: Souris | 15.24 € Inmac Wstore |
![]() | Targus Ultra Mini 5-Button | Catégorie: Souris | 11.90 € MicroChoix |
![]() | HP 2-Button Laser Mouse | Catégorie: Souris | 22.72 € Compufirst |