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

Langage PHP Discussion :

probleme dans mon programme


Sujet :

Langage PHP

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    240
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 240
    Points : 60
    Points
    60
    Par défaut probleme dans mon programme
    bonjour, j'ai fais un programme qui me sert a avoir dans un tableau des checkbox! une fois qu'on coche dessus on clike sur un boutton envoyé qui envoie vers un fichier me donnant la liste des noms! mon probleme c'est que je n'arrive pas a recuperer les noms!
    voici mon programme:
    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
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
     
    session_start();
    include 'connexion_db.php';
    include 'prospect.js';
     
    function afficher_ligne($cpt, $enr)
    {  // alternance des couleurs des lignes de réponses
        $couleur = ($cpt % 2)
                      ? '#EEEEEE'
                      : '#FFFFFF';
       echo "<tr id=".$cpt." bgcolor='#303030' align='center'  onmouseover=setPointer(this,".$cpt.",'over'); onmouseout=setPointer(this,".$cpt.",'out'); onmousedown=setPointer(this,".$cpt.",'click');> ";	
            //echo "<form name=form".$cpt." method=post action='indexA.php?page=paramlettre'>";
        // n° de  réponse
      //  echo '<TD ALIGN="right"  bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%">&nbsp;<B>'.$cpt.'</B>.&nbsp;</TD>';
     
        // cod_prospect
        echo '<TD ALIGN="left"  bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%">&nbsp;';
        echo htmlspecialchars($enr['COD_PROSPECT']);
    	$codepros= htmlspecialchars($enr['COD_PROSPECT']);
        echo "<input type=hidden name=code_prosp value='".$enr['COD_PROSPECT']."'>";
        echo '&nbsp;</TD>';
        //date_prosect
        echo '<TD ALIGN="left"  bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%">&nbsp;';
        echo htmlspecialchars($enr['DATE_PROSPECT']);
        echo '&nbsp;</TD>';
        //civilité
        echo '<TD ALIGN="left"  bgcolor="#303030" class="px12c"  NOWRAP WIDTH="1%">&nbsp;';
        echo htmlspecialchars($enr['CIVILITE']);
        echo '&nbsp;</TD>';
        if ( isset($enr['CIVILITE']) && strtolower($enr['CIVILITE'])=="mlle") echo "<input name='Civilite' type=hidden value=1>\n" ;
        if ( isset($enr['CIVILITE']) && strtolower($enr['CIVILITE'])=="mme") echo "<input name='Civilite' type=hidden value=2>\n"        ;
        if ( isset($enr['CIVILITE']) && strtolower($enr['CIVILITE'])=="mr") echo "<input name='Civilite' type=hidden value=3>\n"       ;
        // nom+email
        echo '<TD ALIGN="left"  bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%">&nbsp;';
        $nom = htmlspecialchars($enr['NOM']);
        if ($enr['EMAIL'] != "")
        {
               $mail=$enr['EMAIL'];
           // $mail = str_replace('@', '_at_', $enr['EMAIL']);
            echo "<A href='javascript:form".$cpt.".submit();'>";
            echo $nom;
            echo "</A>";
            echo "<input type=hidden name='mail' value='".htmlspecialchars($mail)."'/>";
        }
        else { echo $nom;   }
        echo '&nbsp;</TD>';
        echo "<input type=hidden name=nom value='$nom' />";
        //prénom
         echo '<TD ALIGN="left"  bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%">&nbsp;';
        echo htmlspecialchars($enr['PRENOM']);
        echo "<input type=hidden name=prenom value='".$enr['PRENOM']."' />";
        $query="select nom_inst, doc from instrument, prospect_instrument where prospect_instrument.cod_prospect=".$enr['COD_PROSPECT']." and instrument.cod_inst=prospect_instrument.cod_inst";
        $R=mysql_query($query);
        if(mysql_num_rows($R)>0)
        {
        $ins=mysql_fetch_array($R);
        echo "<input type=hidden name=instrument value='".$ins['doc']."+".$ins['nom_inst']."' />";
        }
       // echo $ins['doc']."+".$ins['nom_inst'];
        echo '&nbsp;</TD>';
        echo '</form>';
        //Téléphone
        echo '<TD ALIGN="left"  bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%">&nbsp;';
        echo htmlspecialchars($enr['TEL']);
        echo '&nbsp;</TD>';
        //Adresse
         echo '<TD ALIGN="left"  bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%">&nbsp;';
        echo htmlspecialchars($enr['ADRESSE']);
        echo '&nbsp;</TD>';
        //Cp
         echo '<TD ALIGN="left"  bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%">&nbsp;';
        echo htmlspecialchars($enr['CODE_POSTAL']);
        echo '&nbsp;</TD>';
     
        //Ville
         echo '<TD ALIGN="left"  bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%">&nbsp;';
        echo htmlspecialchars($enr['VILLE']);
       // echo '&nbsp;</TD>';
        echo'<TD ALIGN="center"  bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%">&nbsp;';
    			//echo"<form name='creation' method='post'>";
               //echo '<a href="indexA.php?page=fichepros3&code='.$enr["COD_PROSPECT"].'" ><img src="loupe.png" border=0></a> &nbsp &nbsp';
    			echo"<form action='indexA?page=creationpdf' method=post>";
    			echo "<INPUT type=checkbox name=\"doc\" value=\"$codepros\"/>";
     
     
     
     
      // echo '<a HREF="indexA.php?page=delprospect&code='.$enr["COD_PROSPECT"].'" onCLick="return confirm(\'ATTENTION : Êtes-vous sur de vouloir supprimer cet enregistrement ?\')">
       //<img src="annul.png" border=0></A>';
     
     
     
    }
     
     
     
     
    // If current page number, use it
    // if not, set one!
    /*if (isset($_GET['sup']))
    {
    echo"<script>confirm('ATTENTION : Êtes-vous de vouloir supprimer cet enregistrement ')</script>";
     
    }*/
    /*if(isset($_POST['n_ch_prospect']))    $n_ch_prospect=$_POST['n_ch_prospect'];
    else    $n_ch_prospect="" ;
     
    if(isset($_POST['p_ch_prospect']))    $p_ch_prospect=$_POST['p_ch_prospect'];
    else    $p_ch_prospect="";*/
     
    if(isset($_POST['c_ch_prospect']))    $c_ch_prospect=$_POST['c_ch_prospect'];
    else    $c_ch_prospect="";
     
    if(isset($_POST['v_ch_prospect']))    $v_ch_prospect=$_POST['v_ch_prospect'];
    else    $v_ch_prospect="";
     
    if(isset($_POST['n_contact']))    $n_contact=$_POST['n_contact'];
    else    $n_contact="";
     
    //recupération de la date fin
    if(isset($_POST['jf']))    $jf=$_POST['jf'];
    else    $jf="" ;
     
     
    if(isset($_POST['mf']))    $mf=$_POST['mf'];
    else    $mf="" ;
     
    if(isset($_POST['af']))    $af=$_POST['af'];
    else    $af="" ;
    $date_fin="$af-$mf-$jf";
     
     
    // recupération de la date début
    if(isset($_POST['jd']))    $jd=$_POST['jd'];
    else    $jd="" ;
     
    if(isset($_POST['md']))    $md=$_POST['md'];
    else    $md="" ;
     
    if(isset($_POST['ad']))    $ad=$_POST['ad'];
    else    $ad="" ;
    $date_debut= "$ad-$md-$jd";
    if(!isset($_GET['page2'])){
    	if ($_SESSION['3CHpage2']=="")//Dans ce cas nouvelle recherche
        		$page2 = 1;
        	else
        		$page2=$_SESSION['3CHpage2'];
    } else {
        $page2 = $_GET['page2'];
    }
     
    // Define the number of results per page
    $max_results = 500;
     
    // Figure out the limit for the query based
    // on the current page number.
    $from = (($page2 * $max_results) - $max_results);
     
    if(!isset($_GET['ordre'])){
    	if ($_SESSION['3CHordre']=="")//Dans ce cas nouvelle recherche
        		$ordre = 'COD_PROSPECT';
        	else
        		$ordre = $_SESSION['3CHordre'];
    } else {
        $ordre = $_GET['ordre'];
    }
    if(!isset($_GET['critere'])){
    	if ($_SESSION['3CHcritere']=="")//Dans ce cas nouvelle recherche
        		$critere = $date_debut;
        	else
        		$critere = $_SESSION['3CHcritere'];
    }
    else
    {
    $critere=$_GET['critere'];
    }
    if(!isset($_GET['critere1'])){
    	if ($_SESSION['3CHcritere1']=="")//Dans ce cas nouvelle recherche
        		$critere1 = $date_fin;
        	else
        		$critere1 = $_SESSION['3CHcritere1'];
    }
    else
    {
    $critere1=$_GET['critere1'];
    }
     
    //Mise en session des infos pour le retour sur la recherche des prospects..
     
    	$_SESSION['3CHcritere2']=$critere2;
    	$_SESSION['3CHcritere1']=$critere1;
    	$_SESSION['3CHcritere']=$critere;
    	$_SESSION['3CHordre']=$ordre;
    	$_SESSION['3CHpage2']=$page2;
    if(isset($_POST['n_contact'])or isset($_GET['critere3'])  or ($_SESSION['3CHcritere3']!=""))
     
    {
     
    $controle="&critere3=vrai";
    $_SESSION['3CHcritere3']="vrai";
    $sql1 = "SELECT p.COD_PROSPECT,p.DATE_PROSPECT,p.NOM,p.PRENOM,p.TEL,p.EMAIL,p.CODE_POSTAL,p.CIVILITE,p.VILLE,p.ADRESSE FROM prospect p LEFT  JOIN client_contact cc ON cc.cod_prospect = p.cod_prospect
    WHERE p.DATE_PROSPECT>'$critere' and p.DATE_PROSPECT < '$critere1' AND cc.cod_contact IS  NULL";
    $sql2="SELECT COUNT(*) as Num FROM prospect p LEFT  JOIN client_contact cc ON cc.cod_prospect = p.cod_prospect
    WHERE p.DATE_PROSPECT >'$critere' and p.DATE_PROSPECT < ' $critere1' AND cc.cod_contact IS  NULL";
     
     
    }
    else
    {
    echo $n_contact;
    $controle='';
    $sql1 = "SELECT * FROM prospect where prospect.date_prospect>' $critere' and prospect.date_prospect < ' $critere1'";
    $sql2="SELECT COUNT(*)  FROM prospect where prospect.date_prospect >' $critere' and prospect.date_prospect < ' $critere1'";
    }
     
    //LIMIT $from, $max_results
    $sql1.=" order by '$ordre'";
    $sql = mysql_query ($sql1);
     
    if($total_results==0)
    {
     
    ?>
    <table border="1" width="43%" id="table1">
    	<tr>
    		<td bgcolor="#CCCCCC" height="63">
    		<p align="center"><b><font size="4">Aucun prospect ne correspond aux
    		critères recherchés.</font></b></td>
    	</tr>
    	<tr>
    		<td bgcolor="#CCCCCC">
    		<p align="center"><a href="indexA?page=ProsSearchP"><u><b>C</b></u><b><u>hanger les
    		paramètres de votre recherche</u></b></a></td>
    	</tr>
    </table>
    <?
    }
    else
    {
    $cpt = 0;
    ?>
    <p align="center"><b><font color="#800000" size="4" face="Bookman Old Style">
    LISTE DES PROSPECTS POUR LA PERIODE DU <?php echo $_SESSION['3CHcritere'];?> au <?php echo $_SESSION['3CHcritere1'];?></font></b></p>
     
    <div id='tableau1' style='position:absolute; left:0px; overflow:auto;top:62px;height:23px; width:985px;  visibility: visible'>
    <table border="1" width="100%" bgcolor="#717171" CELLSPACING="1" cellpadding="1">
    <tr>
    	<th width="5%" nowrap  class="px12c">Code</A></th>
    	<th width="10%" nowrap  class="px12c"><A href="<?php echo "$php_self?page=ch_prospect33&ordre=DATE_PROSPECT&critere=$critere&critere1=$critere1 ";?>">Date</A></th>	
    	<th width="5%" nowrap class="px12c"><A href="<?php echo "$php_self?page=ch_prospect33&ordre=CIVILITE&critere=$critere&critere1=$critere1";?>">Civilité</A></th>	
    	<th width="10%" nowrap class="px12c"><A href="<? echo "$php_self?page=ch_prospect33&ordre=NOM&critere=$critere&critere1=$critere1";?>">Nom</A></th>
    	<th width="10%" nowrap class="px12c"><A href="<? echo "$php_self?page=ch_prospect33&ordre=PRENOM&critere=$critere&critere1=$critere1 ";?>">Prénom</A></th>
    	<th width="10%" nowrap class="px12c">Téléphone</A>	</th>
    	<th width="15%" nowrap class="px12c">Adresse</A></th>
    	<th width="5%" nowrap class="px12c"><A href="<? echo"$php_self?page=ch_prospect33&ordre=CODE_POSTAL&critere=$critere&critere1=$critere1";?>">	C.postal</A></th>
    	<th width="15%" nowrap class="px12c">Ville</A>
    		<th width="15%%" nowrap class="px12c">Actions</A>
    	</tr></table>
     
     
     
    </div>
     
    <?
    echo "<div id='tableau2' style='position:absolute;scrollbar-base-color:#262626;scrollbar-face-color:#262626;scrollbar-arrow-color:#FFFFFF;scrollbar-3dlight-color:#262626;scrollbar-highlight-color:#FFFFFF;scrollbar-shadow-color:#FFFFFF;scrollbar-darkshadow-color:#262626; left:0px; overflow:auto;top:85px;height:300px; width:1000px;  visibility: visible'>";
    echo '<table cellspacing=1 cellpadding=3 cols=2 width="100%" bgcolor="#847977" border="0" >';
     
        while ($enr = mysql_fetch_array($sql))
        {
            echo afficher_ligne($cpt + 1, $enr);
            $cpt++;
           echo "</tr>\n";
        }
    ?>
    </table>
    </div>
    <?
     
     echo"<input type=submit  value='Envoyer'>";
    echo"</form>";
    }
    ?>

  2. #2
    Membre expérimenté
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    1 349
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Avril 2006
    Messages : 1 349
    Points : 1 460
    Points
    1 460
    Par défaut
    meme pas le courage de lire ton code tu veus pas afficher juster les parties qui pose probleme..

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    240
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 240
    Points : 60
    Points
    60
    Par défaut
    en faite j'ai une fonction affiche qui met permet d'afficher une liste de nom en l'appelant dans une boucle! dans chaque ligne il y a un checkbox! quand on click sur un checkbox j'ai mi un form pour avoir les reponses dans un autre fichier (creationpdf.php). avant je n'arrivais pas a mettre un boutton envoyer separer du tableau! Maintenant j'y arrive mais j'ai un probleme car dans le fichier creationpdf je demande d'afficher les noms des checkbox selectionné mais la il ne m'affiche rien! les paramettres ne passesnt pas!

  4. #4
    Membre expérimenté
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    1 349
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Avril 2006
    Messages : 1 349
    Points : 1 460
    Points
    1 460
    Par défaut
    mùontre alor juste la partie d'envoi des parametre et le traitemen de récupération et pas tout le script

  5. #5
    Rédacteur

    Homme Profil pro
    Développeur Web
    Inscrit en
    Juillet 2003
    Messages
    695
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Juillet 2003
    Messages : 695
    Points : 1 071
    Points
    1 071
    Par défaut
    haaaaaaaaaa

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     echo '<script type="text/javascript" src="./prospect.js"></script>';
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     echo"<input type=submit  value='Envoyer'>";
    echo"</form>";
    cf. ma signature

    Balise en majuscule, Dreamweaver?
    Si tu veux que l'on t'aide, va falloir etre plus propre (cf. ma signature )

  6. #6
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    240
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 240
    Points : 60
    Points
    60
    Par défaut
    voila quelquechose de plus simple:
    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
     
    Fonction afficher{
    //cette fonction va me permettre d'effectuer des enregitrements ligne par ligne des numéros de clé, nom et prenom et checkbox>
    echo"<form action='creation.pdf' method='post'>"
    echo "<INPUT type=checkbox name=\"doc\" value=\"$codepros\"/>";//codeprof est, ce que je veux recuperer si le checkbox est coché.
    }
    <?
    echo "<div id='tableau2' style='position:absolute;scrollbar-base-color:#262626;scrollbar-face-color:#262626;scrollbar-arrow-color:#FFFFFF;scrollbar-3dlight-color:#262626;scrollbar-highlight-color:#FFFFFF;scrollbar-shadow-color:#FFFFFF;scrollbar-darkshadow-color:#262626; left:0px; overflow:auto;top:85px;height:300px; width:1000px;  visibility: visible'>";
    echo '<table cellspacing=1 cellpadding=3 cols=2 width="100%" bgcolor="#847977" border="0" >';
     
        while ($enr = mysql_fetch_array($sql))
        {
            echo afficher_ligne($cpt + 1, $enr);
            $cpt++;
           echo "</tr>\n";
        }
    echo"<input type='submit'  value='Envoyer'>";
    echo"</form>";
    ?>
    et la je dois recuperer les données dans mon fichier création avec un simple $var=$_POST['doc']; echo $var; mais je ne recupere rien!!!!

  7. #7
    Rédacteur

    Homme Profil pro
    Développeur Web
    Inscrit en
    Juillet 2003
    Messages
    695
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Juillet 2003
    Messages : 695
    Points : 1 071
    Points
    1 071
    Par défaut
    <form action='creation.pdf' method='post'>
    .pdf ???

  8. #8
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    240
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 240
    Points : 60
    Points
    60
    Par défaut
    non je me suis trompé en reécrivant c'est
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <form action='creation.php' method='post'>
    En faite j'ai l'impression que le bouton envoyer ne prend pas en compte les checkbox

  9. #9
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    240
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 240
    Points : 60
    Points
    60
    Par défaut
    personne peut m'aider???

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. problemes dans mon programme?
    Par digitalout dans le forum Débuter
    Réponses: 9
    Dernier message: 26/02/2012, 21h12
  2. Probleme dans mon programme
    Par Sooners dans le forum Langage
    Réponses: 4
    Dernier message: 10/03/2010, 11h01
  3. Integrer une musique dans mon programme
    Par Tutux84 dans le forum C
    Réponses: 2
    Dernier message: 29/01/2005, 12h41
  4. [Lien]erreur dans mon programme python
    Par durnambule dans le forum Général Python
    Réponses: 11
    Dernier message: 29/01/2004, 14h59
  5. [] Utiliser AVI d'une DLL dans mon programme
    Par seb.49 dans le forum VB 6 et antérieur
    Réponses: 5
    Dernier message: 02/05/2003, 14h52

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