Précédent   Forum des professionnels en informatique > PHP > Langage
Langage Forum sur le langage PHP, la POO, les conventions, la sécurité, etc. Avant de poster : FAQ Langage, toutes les FAQ PHP, cours langage et sources PHP
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 03/04/2011, 22h08   #1
Invité de passage
 
Homme
Étudiant
Inscription : avril 2011
Messages : 1
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : Belgique

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : avril 2011
Messages : 1
Points : 0
Points : 0
Par défaut Création d'une calculette

Code :
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
<?php  
 
 
    if (isset($_GET['btn']))
    {
      switch ($_GET['btn']) {
      case 1:
      $myText1 = myAction($_GET['btn']);
      break;
 
      case 2:
      $myText1 =  "dwa";
      break;
      default:
      $myText1 = "inna wartosc";
 
      }
 
    }
 
    else {
      $myText1 =0;
 
    }
 
 
    function myAction($myValue){
 
    return  $myValue;
    }
 
 
 
    ?>  
 
    <center>
    <div style="position: absolute; width: 500px; margin-left: 50%; left: -250px;">
    <form action="Kalkulator.php" method="get">
 
			Kalkulator  </br> </br></br>
 
 
			<input type="text" name="Text1" value="<?php echo $myText1; ?>" style=" width: 210px; float: left; margin-left: 140px;" /> 	
      </br> </br>
			<button type="submit" name="btn" value="C" style="width: 210px;"> C </button>
      </br>                                                                                            
			<button type="submit" name="btn" value="1" style="width:50px;" > 1 </button>
			<button type="submit" name="btn" value="2" style="width:50px;" style="margin-left:10px"; > 2 </button>
			<button type="submit" name="btn" value="3" style="width:50px;" style="margin-left:10px"; > 3 </button>
			<button type="submit" name="btn" value="dodawanie" style="width:50px;" style="margin-left:10px"; > + </button>
			</br>
			<button type="submit" name="btn" value="4" style="width:50px;" style="margin:10px 0px 0px 10px;"; > 4 </button>
			<button type="submit" name="btn" value="5" style="width:50px;" style="margin-left:10px"; > 5 </button>
			<button type="submit" name="btn" value="6" style="width:50px;" style="margin-left:10px"; > 6 </button>
			<button type="submit" name="btn" value="odejmowanie" style="width:50px;" style="margin-left:10px"; > - </button>
			</br>
			<button type="submit" name="btn" value="7" style="width:50px;" style="margin-left:10px"; > 7 </button>
			<button type="submit" name="btn" value="8" style="width:50px;" style="margin-left:10px"; > 8 </button>
			<button type="submit" name="btn" value="9" style="width:50px;" style="margin-left:10px"; > 9 </button>
			<button type="submit" name="btn" value="mnozenie" style="width:50px;" style="margin-left:10px"; > * </button>
			</br>
			<button type="submit" name="btn" value="przecinek" style="width:50px;" style="margin-left:10px"; > , </button>
			<button type="submit" name="btn" value="0" style="width:50px;" style="margin-left:10px"; > 0 </button>
			<button type="submit" name="btn" value="rowna" style="width:50px;" style="margin-left:10px"; > = </button>
			<button type="submit" name="btn" value="dzielenie" style="width:50px;" style="margin-left:10px"; > / </button>    
		</form>
    </div>
    </center>
Donc voila sa c'est un debout que j'ai fait,

Premierement je voudrais savoir pour que: quand je click sur "C" il y a le zero qui s'apparé.
Puis en clickant chaque numero, les nombre ce suive et forme "123456" ect

Merci de votre aide
karolunited est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/04/2011, 23h42   #2
Membre éclairé
 
Avatar de beejeridou
 
Homme
Webmaster
Inscription : février 2007
Messages : 261
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Bas Rhin (Alsace)

Informations professionnelles :
Activité : Webmaster

Informations forums :
Inscription : février 2007
Messages : 261
Points : 315
Points : 315
Je pense que tu devrais te tourner vers le javascript car la tu va faire un rechargement de page à chaque appuis sur un bouton!!!
__________________
Et pourtant... Elle tourne.
http://www.artisan-developpeur.fr
beejeridou est déconnecté   Envoyer un message privé Réponse avec citation 20
Vieux 07/04/2011, 18h08   #3
Membre habitué
 
Avatar de omar24
 
Homme Omar
Inscription : septembre 2010
Messages : 146
Détails du profil
Informations personnelles :
Nom : Homme Omar
Localisation : Maroc

Informations professionnelles :
Secteur : High Tech - Multimédia et Internet

Informations forums :
Inscription : septembre 2010
Messages : 146
Points : 125
Points : 125
salut;

Code :
1
2
3
4
if (isset($_GET['btn']))
    {
     $myText1 .= myAction($_GET['btn']);
}
et pour afficher 0 quand un clic est fait sur C tout simplement

omar24 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 01h43.


 
 
 
 
Partenaires

Hébergement Web