Call a PHP function using a button
Pascal_22
Posted messages
559
Status
Member
-
krabs Posted messages 54 Status Member -
krabs Posted messages 54 Status Member -
<?php function AjoutNote() { echo "
"; } ?> <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>
dedans la sub
"; } 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 "| "; $note=mysql_result($result,$i,"DescNote"); echo "La Note No " . ($i+1) . " " . $note; $i++; echo " |
1 answer
Hello,
Since PHP acts ONLY on the server side it is impossible to use only PHP for that.
We can use AJAX:
A short tutorial: https://www.xul.fr/xml-ajax.html
Since PHP acts ONLY on the server side it is impossible to use only PHP for that.
We can use AJAX:
A short tutorial: https://www.xul.fr/xml-ajax.html