begin process at 2012 05 28 22:36:42
  Trouver un code source :
 
dans
 
Accueil > Forum > 

PHP

 > 

Web 2.0

 > 

Autre

 > 

Envoyer des variable suivant la valeur d'une case à cocher


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

Envoyer des variable suivant la valeur d'une case à cocher

jeudi 25 mars 2010 à 16:52:54 | Envoyer des variable suivant la valeur d'une case à cocher

nostalgieing

Salut à tous,

Je suis débutante en php et je suis en train de développer mon premier site web.
J'ai un problème que je souhaite bien que vous pouvez m'aidez!
J'ai deux pages web la première est ajouter_facture.php cette page contient un tableau contenant les cartes d'expédition de la table carte_expedtion(id,num_carte_expedition,num_bon_acceptation,nom_client,
nom_destinataire,distance,tot_ht...) devant chaque carte dans le tableau du formulaire il ya une case à cocher. l'utilisateur choisit parmis les cartes d'expéditions à facturer en cochant la case et clique sur le bouton submit alors la page voir facture.php s'affiche. Le problème c'est que je doit envoyer l'identifiant """"""id """""des lignes du tableaux ayant la case à cocher bien cochée pour pouvoir récupérer dans la page affiche_facture toutes les informations nécessaires.

Voici le code de deux pages:

page1: ajouter_facture.php

<head>
<script langage="javascript">
function cbox_coches()
{
var i;
var obj_input;
var nb_coche = 0;
for (i = 0; i < form1.elements.length; i++)
{
obj_input = form1.elements[i];
if( obj_input.type=="checkbox")
{
if( obj_input.checked)
nb_coche ++; $_POST['<?php echo $row->id;?>'];
}
else {
alert("Veuillez choisir une carte d'expédition à facturer")
return false;
}

</script>
</head>



<body>
<table width="2000" border="0">
<tr>
<td width="17"><?php
$date = date("d/m/Y");
Print($date);?></td>
<td width="1610"><div align="right"><a href="index.php"><img src="images/quitter.jpg" alt="Déconnection" width="58" height="61" border="0" /></a></div></td>
</tr>
</table>
<p align="center"> </p>
<form id="form1" name="form1" method="post" onsubmit="return cbox_coches()"action="voir_facture.php">
<p align="center"> <table width="1000" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCE6FF">
<tr rowspan="4" bgcolor="#CCE6E6">
<td height="50" colspan="4" > <div align="center" class="Style1">
<div align="center" class="Style3">Ajouter Facture </div></td>
</tr>
<tr rowspan="3" ><td colspan="4" nowrap="nowrap" ><div align="center"><span class="Style4"></span></div></td>
</tr>
<tr >
<td width="93"><div align="center"><span class="Style4"></span></div></td>
<td width="242" nowrap="nowrap" ><div align="center" class="Style4">
<div align="left"></div>
</div></td>
<td width="333" >

<div align="center" class="Style4">
<div align="left"></div>
</div></td>
<td width="1373"><div align="center"><span class="Style4"></span></div></td>
</tr>

<tr >
<td ><span class="Style4"></span></td>
<td ><div align="left" class="Style11">Nom Client </div></td>
<td ><div align="center" class="Style4">
<div align="left">
<input name="nom_client" type="text" id="nom_client" size="25" />
</div>
</div></td>
<td><span class="Style4"></span></td>
</tr>
<tr >
<td ><div align="center"><span class="Style4"></span></div></td>
<td ><div align="left" class="Style6">
<div align="left"></div>
</div></td>
<td >

<div align="center" class="Style4">
<div align="left"></div>
</div></td>
<td><div align="center"><span class="Style4"></span></div></td>
</tr>
</table>
</p>

<?php include("connexion.php");

$i=0;
import_request_variables(gp);
$req=mysql_query("select * from carte_expedition where nom_client '".$nom_client."%' ")or die (mysql_error());
$row=mysql_fetch_object($req);
?>
<table width="830" align="center">
<tr bgcolor="#CCE6E6">
<td width="28" height="20" nowrap="nowrap" bgcolor="#CCE6E6" ><div align="center"><span class="Style9">N°</span></div></td>
<td width="76" nowrap="nowrap" bgcolor="#CCE6E6"><div align="center"><span class="Style9">Num carte </span></div></td>
<td width="110" nowrap="nowrap" bgcolor="#CCE6E6"><div align="center"><span class="Style9">Client</span></div></td>
<td width="105" nowrap="nowrap" bgcolor="#CCE6E6"><div align="center"><span class="Style9"> Destinataire</span></div></td>
<td width="111" nowrap="nowrap" bgcolor="#CCE6E6"><div align="center"><span class="Style9"> Expédireur </span></div></td>
<td width="86" nowrap="nowrap" bgcolor="#CCE6E6"><div align="center"><span class="Style9">Distance </span></div></td>
<td width="97" nowrap="nowrap" bgcolor="#CCE6E6"><div align="center"><span class="Style9">Totoal.HT</span></div></td>
<td width="120" nowrap="nowrap" bgcolor="#CCE6E6" ><div align="center"><span class="Style9" > Date </span></div></td>
<td width="39" ><div align="center" class="Style9">Cocher</div></td>
</tr>
<tr bgcolor=<?php echo $col; ?> onmouseover="bgcolor="#DFFFFF"">
<td bgcolor="<?php echo $col; ?>"><span class="Style14 Style10 Style4"><?php echo $i;?></span></td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"><span class="Style14 Style10 Style4" id="num_carte"><?php echo $row->num_carte_expedition; ?></span></td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"><span class="Style14 Style10 Style4" ><?php echo $row->nom_client; ?></span></td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"><span class="Style14 Style10 Style4"><?php echo $row->nom_destinataire; ?></span></td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"><span class="Style14 Style4 Style10 Style4"><?php echo $row->nom_expediteur; ?></span></td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"><span class="Style10 Style4"><?php echo $row->distance_parcourue; ?></span></td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"> </td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>" ><span class="Style14 Style4 Style10 Style4"><?php echo $row->date_carte_expedition;?></span></td>
<td>
<input type="checkbox" name="case[]" />
</td>
</tr>
</table>

<input name="Submit2" type="submit" class="Style11" value="Quitter" />


<input name="Submit3" type="submit" class="Style11" value="Facturer" />

</form>
</body>
</html>



la page 2 voir_facture.php


<body>
<table width="891" align="center">
<tr>
<td width="883">
<fieldset>
<div align="center"><br />
Client:
<input type="text" name="nom_client" />
N°Facture:
<input type="text" name="num_facture" />
</div>
</fieldset></td></tr></table>

<?php include("connexion.php");
import_request_variables(gp);
$req=mysql_query("select * from id='echo $_POST['id']'")or die (mysql_error());
$row=mysql_fetch_object($req);
?>
//dans ce tableau je doit récupérer les données de la carte d'expédition que j'ai coché

<table width="899" align="center">
<tr bgcolor="#CCE6E6">
<td width="28" height="20" nowrap="nowrap" ><div align="center" class="Style2"><span class="Style9">N°</span></div></td>
<td width="76" nowrap="nowrap"><div align="center" class="Style2">ID.BL</div></td>
<td width="76" nowrap="nowrap"><span class="Style2">N° Bon Acceptation </span></td>
<td width="76" nowrap="nowrap"><span class="Style2">Départ</span></td>
<td width="76" nowrap="nowrap"><span class="Style2">Arrivée</span></td>
<td width="110" nowrap="nowrap"><div align="center" class="Style2"><span class="Style9">Distance </span></div></td>
<td width="105" nowrap="nowrap"><div align="center" class="Style2"><span class="Style9">Marchandise</span></div></td>
<td width="111" nowrap="nowrap"><div align="center" class="Style2">Poids Net </div></td>
<td width="108" nowrap="nowrap"><div align="center" class="Style2">PU.HT </div></td>
<td width="97" nowrap="nowrap"><div align="center" class="Style2"><span class="Style9">Totoal.HT</span></div></td>
<td width="120" nowrap="nowrap" ><div align="center" class="Style2"><span class="Style9" > Date BL </span></div></td>
</tr>
<tr bgcolor=<?php echo $col; ?> onmouseover="bgcolor="#DFFFFF"">
<td bgcolor="<?php echo $col; ?>"><span class="Style14 Style10 Style4"><?php echo $i;?></span></td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"><span class="Style14 Style10 Style4" id="num_carte"><?php echo $row->num_carte_expedition; ?></span></td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"> </td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"> </td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"> </td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"><span class="Style10 Style4"><?php echo $row->distance_parcourue; ?></span></td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"><span class="Style14 Style4 Style10 Style4"><?php echo $row->nom_marchandise; ?></span></td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"> </td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"> </td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>"> </td>
<td nowrap="nowrap" bgcolor="<?php echo $col; ?>" ><span class="Style14 Style4 Style10 Style4"><?php echo $row->date_carte_expedition;?></span></td>
</tr>
<?php }?>

</table>
<table width="900" align="center">
<tr>
<td>
<fieldset>
<label>
<input name="btn1" type="submit" id="btn1" class="style5"/>
</label>
<input name="btn2" type="button" id="btn2" padding=" 3px 30px" background-color="#FFECEC" border=" 1px solid #990000"/>
TVA
<label>
<input type="text" name="textfield4" />
</label>
Timbre:

<input type="text" name="textfield42" />

<p>
<input name="btn3" type="button" id="btn3" padding=" 3px 30px" background-color="#FFECEC" border=" 1px solid #990000"/>
<input name="btn4" type="button" id="btn4" padding=" 3px 30px" background-color="#FFECEC" border=" 1px solid #990000"/>
</p>
<p>
<input name="btn5" type="button" id="btn4" padding=" 3px 30px" background-color="#FFECEC" border=" 1px solid #990000"/>
<input name="btn6" type="button" id="btn5" padding=" 3px 30px" background-color="#FFECEC" border=" 1px solid #990000"/>
</p>
<p>
<input name="btn7" type="submit" id="btn6" class="style5"/>
</p>

</fieldset>
</td></tr></table>
</p>

<div align="right">
<input name="submit1" type="submit" class="Style2" id="submit1" value="Quitter" />
<input name="submit2" type="submit" class="Style2" id="submit2" value="Imprimer" />
<input name="submit3" type="submit" class="Style2" id="submit3" value="Ok" />
</div>
</body>
</html>


Je serai très reconnaissante si vous serez patient pour comprendre mon code et m'aider.
Merci pour toute personne qui essayera.
Merciiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii


Cette discussion est classée dans : php, case, cocher, carte, facture


Répondre à ce message

Sujets en rapport avec ce message

carte en php [ par bililbot ] bonjour a tous , je suis nouveau dans le milieu du php j est une cinquantaine d heure de cours + mes heures persos devant mon ecran .je suis en trai test d'une case à cocher en PHP [ par guinnessboy ] bonjour, Des tonnes de doc et on trouve pas ce qu'on cherche.Je récupère un formulaire HTML dans mon PHP. Comment je teste la valeur d'un checkbox ??? case à cocher et php [ par sebalex ] Salut à tous,Je ne sais pas si utiliser Javascript ou PHP. Tout compte fait, voilà mon problème:J'affiche une liste de tâche reprise d'une bdd (MySQL) traduction case à cocher en php [ par bere27 ] Bonjour, j'ai un souci de traduction au niveau de la case à cocher du code dans la page html.Je viens de créer une source TRADUCTION CASE A COCHER EN Variables+cases à cocher en php [ par nostalgieing ] Bonjour à tous, Je suis débutante en php et j'ai besoin vraiment de votre aide! J'ai une page contenant un tableau affichant toutes les données d'un récuperer une case à cocher en php [ par langagec08 ] Bonjour tous le monde .jaimerai savoir comment puis-je récupérer une case qui est coché je m'explique : dans mon code PHP/MYSQL j' ai sous forme de ta checkbox et php [ par aamsa ] Bonsoir à toutes et à tous,je suis entrein de coder une interface qui m'affiche des messages d'aprés une base de données, les messages sont afficher d calcul de champs selon coefficient... [ par cyse ] Bonjour,C'est pas evident à expliquer, mais surement assez simple a ecrire en php... J'aimerais, qu'un code php recupere les données (numériques) x y case a cocher rester connecté [ par ju0123456789 ] Bonjour !Je voudrais savoir comment on fait pour mettre une case à cocher "rester connecté" comme il y a sur beaucoup de site svp ?Je n'ai aucune idée importer des données d'une page en php [ par nostalgieing ] bonjour j'ai implementé deux pages en php dont je dois extraire les données d'une page vers l'autre et j'utilise un bouton de type image mais j'ai pa


Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,250 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales