IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Collection et Stream Java Discussion :

envoye d array vers un panier avec javaS


Sujet :

Collection et Stream Java

  1. #1
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2016
    Messages
    216
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Ardèche (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Avril 2016
    Messages : 216
    Points : 90
    Points
    90
    Par défaut envoye d array vers un panier avec javaS
    bonjour,
    je vient vous voir aujourd'hui pour une petite question.
    J'ai suivie le tutora pour la création d'un panier.php proposer sur le forum
    http://jcrozier.developpez.com/articles/web/panier/

    et j'ai un petit soucis avec la fonction javaS
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <a href="panier.php?action=ajout&amp;l=LIBELLEPRODUIT&amp;q=QUANTITEPRODUIT&amp;p=PRIXPRODUIT" onclick="window.open(this.href, '', 
    'toolbar=no, location=no, directories=no, status=yes, scrollbars=yes, resizable=yes, copyhistory=no, width=600, height=350'); return false;">Ajouter au panier</a>
    en effet mon soucis est que pour ma part cela ressemblerais plus a cela

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <a href="panier.php?action=ajout&amp;l=$data[$i]['nom_du_jeu']&amp;q=$data[$i]['quantite']&amp;p=$data[$i]['prix']" onclick="window.open(this.href, '', 
    'toolbar=no, location=no, directories=no, status=yes, scrollbars=yes, resizable=yes, copyhistory=no, width=600, height=350'); return false;">Ajouter au panier</a>
    mais en faisant cela j'obtient ce probleme

    Notice: Array to string conversion in C:\xampp\htdocs\projet-web-dynamique-soulier-joris\PHP\site_connection_user\categorie\tableau_achat.php on line 141

    Notice: Array to string conversion in C:\xampp\htdocs\projet-web-dynamique-soulier-joris\PHP\site_connection_user\categorie\tableau_achat.php on line 141

    Notice: Array to string conversion in C:\xampp\htdocs\projet-web-dynamique-soulier-joris\PHP\site_connection_user\categorie\tableau_achat.php on line 141
    Ajouter au panier
    la ligne 141 étant celle du javaS
    bon cela est normal, mais je ne sais pas trop comment le modifier si quelqu'un peu m orienter ou m'aider ?

    mon code entier etant

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    	<table width="100%">
    						<tr style="height: 16px" align="center">
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										#
    									</b>
    								</font>
    							</td>
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										image
    									</b>
    								</font>
    							</td>
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										nom_du_jeu
    									</b>
    								</font>
    							</td>
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										date_sortie
    									</b>
    								</font>
    							</td>
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										nbr de joueurs
    									</b>
    								</font>
    							</td>
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										prix
    									</b>
    								</font>
    							</td>
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										quant dispo
    									</b>
    								</font>
    							</td>
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										acheter
    									</b>
    								</font>
    							</td>
    						</tr>
    <!------------------------------------------------------------------------------------------------------------------------------------>
    					<!-- fin de l'entete de notre tableau -->
    <!------------------------------------------------------------------------------------------------------------------------------------>						
    						<?php
    //<!------------------------------------------------------------------------------------------------------------------------------------>
    							//<!-- on compte le nombre de lignes dans le fichier texte -->
    //<!------------------------------------------------------------------------------------------------------------------------------------>						
    							$nb_elements = count($data);
    							$nb_lignes= $nb_elements;
    //<!------------------------------------------------------------------------------------------------------------------------------------>
    							//<!-- on ouvre une boucle 'for' qui tournera autant de fois qu'il y a de lignes dans le fichier texte -->
    //<!------------------------------------------------------------------------------------------------------------------------------------>							
    							for ($i = 0; $i < $nb_lignes; $i ++)
    								{
    //<!------------------------------------------------------------------------------------------------------------------------------------>									
    									// <!-- Définition de la position à afficher -->
    //<!------------------------------------------------------------------------------------------------------------------------------------>									
    									?>
    <!------------------------------------------------------------------------------------------------------------------------------------>									
    										<!-- on affiche les infos des jeux dans chaque ligne du tableau-->
    <!------------------------------------------------------------------------------------------------------------------------------------>										
    										<tr style="height: 16px" align="center" bgcolor="#dddddd">
    											<td>
    												<?php 
    													echo 
    														isset($data[$i]['id']) ? 
    															$data[$i]['id'] : ''
    														; 
    												?>
    											</td>
    											<td>
    												<?php 
    													echo 
    														isset($data[$i]['image']) ? 
    															"<img src=\" ".$data[$i]['image']."\">" : ''
    														; 
    												?>
    											</td>
    											<td>
    												<?php 
    													echo 
    														isset($data[$i]['nom_du_jeu']) ? 
    															$data[$i]['nom_du_jeu'] : ''
    														; 
    												?>
    											</td>
    											<td>
    												<?php 
    													echo 
    														isset($data[$i]['date_sortie']) ? 
    															$data[$i]['date_sortie'] : ''
    														; 
    												?>
    											</td>
    											<td>
    												<?php 
    												echo 
    													isset($data[$i]['nbr de joueurs']) ? 
    														$data[$i]['nbr de joueurs'] : ''
    													; 
    												?>
    											</td>
    											<td>
    												<?php 
    												echo 
    													isset($data[$i]['prix']) ? 
    														$data[$i]['prix'] : ''
    													; 
    												?>
    											</td>
    											<td>
    												<?php 
    													echo 
    														isset($data[$i]['quantite']) ? 
    															$data[$i]['quantite'] : ''
    														; 
    												?>
    											</td>
    											<td>
    												<?php 
    												echo 
    													"<a href='../achat/panier.php?action=ajout&amp;l=$data[$i]['nom_du_jeu']&amp;q=$data[$i]['quantite']&amp;p=$data[$i]['prix']' onclick='window.open(this.href, '', 
    'toolbar=no, location=no, directories=no, status=yes, scrollbars=yes, resizable=yes, copyhistory=no, width=600, height=350'); return false;'>Ajouter au panier</a>"
    													; 
    												?>
    											</td>
    										</tr>
    									<?php
    									}
    //<!------------------------------------------------------------------------------------------------------------------------------------>									
    								// <!-- Fin de la boucle for -->
    //<!------------------------------------------------------------------------------------------------------------------------------------>								
    								?>
    					</table>

  2. #2
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2016
    Messages
    216
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Ardèche (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Avril 2016
    Messages : 216
    Points : 90
    Points
    90
    Par défaut
    j'ai trouver une solution

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    for ($i = 0; $i < $nb_lignes; $i ++)
    								{
    									$new_ligne= array();
    									$new_ligne[0]= $data[$i]['id'];
    									$new_ligne[1]= $data[$i]['nom_du_jeu'];
    									$new_ligne[2]= $data[$i]['date_sortie'];
    									$new_ligne[3]= $data[$i]['image'];
    									$new_ligne[4]=$data[$i]['nbr de joueurs'];
    									$new_ligne[5]= $data[$i]['prix'];
    									$new_ligne[6]= $data[$i]['quantite'];
    									$id=$new_ligne[0];
    									$nom_du_jeu=$new_ligne[1];
    									$date=$new_ligne[2];
    									$image=$new_ligne[3];
    									$joueurs=$new_ligne[4];
    									$prix=$new_ligne[5];
    									$stock=$new_ligne[6];
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    "<a href='../achat/panier.php?action=ajout&amp;l=$nom_du_jeu&amp;q=achat&amp;p=$prix' onclick='window.open(this.href, '', 
    'toolbar=no, location=no, directories=no, status=yes, scrollbars=yes, resizable=yes, copyhistory=no, width=600, height=350'); return false;'>Ajouter au panier</a>"
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    	<table width="100%">
    						<tr style="height: 16px" align="center">
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										#
    									</b>
    								</font>
    							</td>
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										image
    									</b>
    								</font>
    							</td>
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										nom_du_jeu
    									</b>
    								</font>
    							</td>
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										date_sortie
    									</b>
    								</font>
    							</td>
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										nbr de joueurs
    									</b>
    								</font>
    							</td>
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										prix
    									</b>
    								</font>
    							</td>
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										quant dispo
    									</b>
    								</font>
    							</td>
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										quant desiré
    									</b>
    								</font>
    							</td>							
    							<td bgcolor="#cccccc">
    								<font class="font_p" color="#5d8eb3">
    									<b>
    										acheter
    									</b>
    								</font>
    							</td>
    						</tr>
    <!------------------------------------------------------------------------------------------------------------------------------------>
    					<!-- fin de l'entete de notre tableau -->
    <!------------------------------------------------------------------------------------------------------------------------------------>						
    						<?php
    //<!------------------------------------------------------------------------------------------------------------------------------------>
    							//<!-- on compte le nombre de lignes dans le fichier texte -->
    //<!------------------------------------------------------------------------------------------------------------------------------------>						
    							$nb_elements = count($data);
    							$nb_lignes= $nb_elements;
    //<!------------------------------------------------------------------------------------------------------------------------------------>
    							//<!-- on ouvre une boucle 'for' qui tournera autant de fois qu'il y a de lignes dans le fichier texte -->
    //<!------------------------------------------------------------------------------------------------------------------------------------>							
    							for ($i = 0; $i < $nb_lignes; $i ++)
    								{
    									$new_ligne= array();
    									$new_ligne[0]= $data[$i]['id'];
    									$new_ligne[1]= $data[$i]['nom_du_jeu'];
    									$new_ligne[2]= $data[$i]['date_sortie'];
    									$new_ligne[3]= $data[$i]['image'];
    									$new_ligne[4]=$data[$i]['nbr de joueurs'];
    									$new_ligne[5]= $data[$i]['prix'];
    									$new_ligne[6]= $data[$i]['quantite'];
    									$id=$new_ligne[0];
    									$nom_du_jeu=$new_ligne[1];
    									$date=$new_ligne[2];
    									$image=$new_ligne[3];
    									$joueurs=$new_ligne[4];
    									$prix=$new_ligne[5];
    									$stock=$new_ligne[6];
    //<!------------------------------------------------------------------------------------------------------------------------------------>									
    									// <!-- Définition de la position à afficher -->
    //<!------------------------------------------------------------------------------------------------------------------------------------>									
    									?>
    <!------------------------------------------------------------------------------------------------------------------------------------>									
    										<!-- on affiche les infos des jeux dans chaque ligne du tableau-->
    <!------------------------------------------------------------------------------------------------------------------------------------>										
    										<tr style="height: 16px" align="center" bgcolor="#dddddd">
    											<td>
    												<?php 
    													echo 
    														isset($id) ? 
    															$id : ''
    														; 
    												?>
    											</td>
    											<td>
    												<?php 
    													echo 
    														isset($image) ? 
    															"<img src=\" ".$image."\">" : ''
    														; 
    												?>
    											</td>
    											<td>
    												<?php 
    													echo 
    														isset($nom_du_jeu) ? 
    															$nom_du_jeu : ''
    														; 
    												?>
    											</td>
    											<td>
    												<?php 
    													echo 
    														isset($date) ? 
    															$date : ''
    														; 
    												?>
    											</td>
    											<td>
    												<?php 
    												echo 
    													isset($joueurs) ? 
    														$joueurs : ''
    													; 
    												?>
    											</td>
    											<td>
    												<?php 
    												echo 
    													isset($prix) ? 
    														$prix : ''
    													; 
    												?>
    											</td>
    											<td>
    												<?php 
    													echo 
    														isset($stock) ? 
    															$stock : ''
    														; 
    												?>
    											</td>
    											<td>
    												<input type="number" name="achat" name="achat" value="0"  required/>
    											</td>
    											<td>
    												<?php 
    												echo 
    													"<a href='../achat/panier.php?action=ajout&amp;l=$nom_du_jeu&amp;q=achat&amp;p=$prix' onclick='window.open(this.href, '', 
    'toolbar=no, location=no, directories=no, status=yes, scrollbars=yes, resizable=yes, copyhistory=no, width=600, height=350'); return false;'>Ajouter au panier</a>"
    													; 
    												?>
    											</td>
    										</tr>
    									<?php
    									}
    //<!------------------------------------------------------------------------------------------------------------------------------------>									
    								// <!-- Fin de la boucle for -->
    //<!------------------------------------------------------------------------------------------------------------------------------------>								
    								?>
    					</table>

    mais j'aimerais savoir si y a pas plus simple ^^" merci a vous
    et aussi me dire si possible comment regler le soucis vis a vis de 'q' car cela prend en compte mon stock et non pas la quantite desirer

  3. #3
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    Et aucun rapport avec le forum java, tu t'es trompé de forum

  4. #4
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2016
    Messages
    216
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Ardèche (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Avril 2016
    Messages : 216
    Points : 90
    Points
    90
    Par défaut
    bah si cette partie du code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <a href="panier.php?action=ajout&amp;l=LIBELLEPRODUIT&amp;q=QUANTITEPRODUIT&amp;p=PRIXPRODUIT" onclick="window.open(this.href, '', 
    'toolbar=no, location=no, directories=no, status=yes, scrollbars=yes, resizable=yes, copyhistory=no, width=600, height=350'); return false;">Ajouter au panier</a>
    qui doit envoyer les info au panier , et qui doit logiquement le faire apparaître comme une petite fenêtre.
    Or je n'est pas de petite fenêtre , mais une nouvelle page ( sur la meme fenêtre ) et les données sont mal envoyer, vu qu'au lieu d avoir 'achat' pour q , j ai quantité
    donc je pense etre bel et bien sur la bonne partie du forum ^^

  5. #5
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    ici c'est java, pour le javascript, c'est ce forum là: http://www.developpez.net/forums/f23...rt/javascript/

  6. #6
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2016
    Messages
    216
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Ardèche (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Avril 2016
    Messages : 216
    Points : 90
    Points
    90
    Par défaut
    bah si un modo peu deplacer ^^

Discussions similaires

  1. Envoyer SMS de Pc vers Telephone avec Java
    Par yazidi_marwen dans le forum Développement Web en Java
    Réponses: 0
    Dernier message: 02/05/2012, 13h43
  2. envoyé un mail avec java sans java-mail
    Par walidinfo dans le forum API standards et tierces
    Réponses: 5
    Dernier message: 03/11/2010, 14h12
  3. Comment envoyer un e-mail avec java
    Par nix01 dans le forum Servlets/JSP
    Réponses: 2
    Dernier message: 15/09/2009, 22h58
  4. Réponses: 10
    Dernier message: 04/06/2009, 10h54
  5. Réponses: 3
    Dernier message: 02/07/2008, 19h08

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo