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

JavaScript Discussion :

pb de checkbox cochées en meme temps [Débutant(e)]


Sujet :

JavaScript

  1. #1
    Membre habitué
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    344
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 344
    Points : 158
    Points
    158
    Par défaut pb de checkbox cochées en meme temps
    salut,

    j ai un formulaire php/mysql ou je lance ma requete et le resultat je l affiche dans un tableau ( ca c ok ), pour chaque ligne de mon tableau j ai 2 checkbox

    en fait je voudrais :

    quand je coche une checkbox dans une ligne l autre de la meme ligne soit coché donc j ai fait une condition mais ca fonctionne pas quand je submitte

    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
     
    $sql1="SELECT distinct `volume` FROM `volumeflow` WHERE 1 ".$find;
    /*echo" sql1 : ".$sql1;
    echo"<br><br>";*/
    /*------------PAGINATION ------------------*/
     
    		$result1 = $db->sql_query($sql1);
    		$numrows = $db->sql_numrows($result1);
    		/*echo"numrows : ".$numrows;
    		echo"<br><br>";*/
     
    		$maxrow=40;
    		/*echo"maxrow : ".$maxrow;
    		echo"<br><br>";*/
     
    		$maxpage=ceil($numrows/$maxrow);
    		/*echo"maxpage : ".$maxpage;
    		echo"<br><br>";*/
     
    		$limitesuivante = $pgno + $maxrow;
    		$limiteprecedente = $pgno - $maxrow;
    /*---------------------------------------------------------------------**/
    	if ($orderby=="")
    	{
    	$order="";
    	}
    	else
    	{
    	$order="ORDER BY $orderby";
    	}
     
     
     
    	echo"<form name='formvol' action='testvol.php?checkboxBG=$checkboxBG&amp;checkboxRO=$checkboxRO'>";
    	echo"<input type='submit'>";
     
    	$result1 = $db->sql_query($sql1 .$order. " LIMIT ". $pgno*$maxrow . "," . ($maxrow+1));
     
    	//echo $sql1 .$order. " LIMIT ". $pgno*$maxrow . "," . ($maxrow+1);
     
    	while($row1 = $db->sql_fetchrow($result1)) 
    	{
     
     
     
    			$volume= $row1['volume'];
    			/*echo "volume : ".$volume;
    			echo"<br>";
    			echo"<br>";*/
     
     
    				$sql2="select status,lv from volumeflow where volumeflow.lv='BG' and volume='".$volume."'";
     
    				$result2 = $db->sql_query($sql2 .$order. " LIMIT ". $pgno*$maxrow . "," . ($maxrow+1));
     
    				while($row2 = $db->sql_fetchrow($result2)) 
    				{
     
    				$statusBG= $row2['status'];
    				/*echo "status : ".$status;
    				echo"<br>";
    				echo"<br>";*/
     
    				$lvBG= $row2['lv'];
    				/*echo "lv : ".$lv;
    				echo"<br>";
    				echo"<br>";*/
     
    						$sql3="select status,lv from volumeflow where volumeflow.lv='RO' and volume='".$volume."'";
     
    						$result3 = $db->sql_query($sql3 .$order. " LIMIT ". $pgno*$maxrow . "," . ($maxrow+1));
     
    						while($row3 = $db->sql_fetchrow($result3)) 
    						{
     
    						$statusRO= $row3['status'];
    						/*echo "status : ".$status;
    						echo"<br>";
    						echo"<br>";*/
     
    						$lvRO= $row3['lv'];
    						/*echo "lv : ".$lv;
    						echo"<br>";
    						echo"<br>";*/
     
    echo <<< myBlock
     
     
     
    		<tr class="$row_class" onMouseover="this.className='highlight_a';" onMouseout="this.className='$row_class';">
     
    			<td align="center">$volume</td>  
    			<td align="center">$statusBG</td>
    			<td align="center"><input type="checkbox" name="checkboxBG" value=$volume.$lvBG ></td>
    			<td align="center">$statusRO</td>
    			<td align="center"><input type="checkbox" name="checkboxRO" value=$volume.$lvRO ></td>
     
    		</tr>\n
     
     
    myBlock;
     
    				}}
     
    		}//fin du while
     
    		$checkboxBG=$_GET['checkboxBG'];
     
     
    		$checkboxRO=$_GET['checkboxRO'];      
    		echo"</form>";
     
     
    			if (document.formvol.checkboxBG.checked)
    			{
    			$volumeBG=substr($checkboxBG,0,12);
     
    				if (document.formvol.checkboxRO.value==$volumeBG.$lvRO)
    				{
    				(document.formvol.checkboxRO.checked);
    				}
     
    			}

    car avec le $_GET je recupere ce qui a ete coché


    merci

  2. #2
    Membre habitué
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    344
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 344
    Points : 158
    Points
    158
    Par défaut
    peut etre en modifiant comme ca mais ca ne fonctionne pas non plus

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
     
    <td align="center"><input type="checkbox" name="checkboxBG" value=$volume.$lvBG.$i onclick=("document.formvol.checkboxRO.$volume.$lvRO.$i.checked")></td>
    			<td align="center">$statusRO</td>
    			<td align="center"><input type="checkbox" name="checkboxRO" value=$volume.$lvRO.$i onclick=("document.formvol.checkboxBG.$volume.$lvBG.$i.checked")></td>

  3. #3
    Membre habitué
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    344
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 344
    Points : 158
    Points
    158
    Par défaut
    quel qu un a une idee un lien un tuto merci

  4. #4
    Membre habitué
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    344
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 344
    Points : 158
    Points
    158
    Par défaut
    fonction js:

    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
     
     
    function selectrow(x,y)
    {
     
     
     
    alert(x);	
     
     
     
    alert(y);	
     
    	if (document.formstatus.elements[x].checked==true)
    	{
    	document.formstatus.elements[y].checked=true;
     
    	}
     
    }
    form php:


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <td align="center"><input type="checkbox" name="checkboxBG$i" value="$volume" onClick="selectrow(document.formstatus.checkboxBG$i.name,document.formstatus.checkboxRO$j.name);" ></td>

    merci Kerod,SpaceFrog et Hervé Saladin

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

Discussions similaires

  1. [PHP-JS] [newbie] pb de checkbox cochées en meme temps
    Par megapacman dans le forum Langage
    Réponses: 1
    Dernier message: 11/06/2006, 17h31
  2. nombre de checkbox cochés
    Par manaboko dans le forum Général JavaScript
    Réponses: 6
    Dernier message: 02/05/2005, 15h39
  3. [débutant] obtenir le nombre de checkbox cochées
    Par macke_d dans le forum Composants
    Réponses: 3
    Dernier message: 30/03/2005, 02h17
  4. Réponses: 9
    Dernier message: 12/01/2005, 17h00
  5. [XML][XSL]afficher une checkbox cochée
    Par kirk80 dans le forum XMLRAD
    Réponses: 2
    Dernier message: 16/09/2004, 17h49

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