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 :

faire communiquer 2 requêtes php


Sujet :

Langage PHP

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    107
    Détails du profil
    Informations personnelles :
    Âge : 48
    Localisation : France, Pyrénées Orientales (Languedoc Roussillon)

    Informations forums :
    Inscription : Avril 2006
    Messages : 107
    Points : 70
    Points
    70
    Par défaut faire communiquer 2 requêtes php
    Bonjour,

    voilà j'ai le code suivant :

    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
    <?php
    	include ("../connexion.php");
     
    	$sqlquery="SELECT eid,subject FROM phpc_events ORDER BY eid";
    	$results= mysql_query($sqlquery);
    	$sqlaffich="SELECT phpc_occurrences.eid, phpc_occurrences.startdate, phpc_occurrences.enddate, phpc_occurrences.starttime, phpc_occurrences.endtime, phpc_events.eid, phpc_events.subject FROM phpc_occurrences, phpc_events WHERE phpc_occurrences.eid=phpc_events.eid AND phpc_occurrences.eid=".$_GET['phpc_events.subject'];
    	$res_affich=mysql_query($sqlaffich);
    	$row_affich=mysql_fetch_array($res_affich);
     
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
    	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <head>
    	<title>S'inscrire à un cours</title>
    </head>
    <body>
    	<FORM NAME="a_them" ACTION="inscription_cours_ok.php" METHOD="GET" enctype="multipart/form-data">
    		<p class="adm_txtform">Choisir un thème :</p>
    				<SELECT name="subject">
    			<?php
    				while ($row=mysql_fetch_array($results))
    				{
    			?>
    				<OPTION value="<?php echo $row['eid'] ;?>"><?php echo $row['subject']; ?></OPTION>
    			<?php
    				}
    			?>				
    		</SELECT><br />
    		Date du cours : <?php echo $row_affich['startdate']; ?> Horaires : <?php echo $row_affich['starttime']; ?> à <?php echo $row_affich['endtime']; ?><br />
    		S'inscrire à ce cours ?
    		<INPUT TYPE="submit" VALUE="Valider" name="valid" id="ok">
    	</form>
    </body>
    </html>
    Je sais pourquoi il ne fonctionne pas... je n'ai pas dit à la requete affich où il devait prendre ses informations pour le GET... Seulement je ne sais pas comment faire .
    Je voudrais que lorsque la personne choisie une option dans le champ select, la date et l'heure de cette option figure juste en dessous...
    Si quelqu'un pouvait m'aider et m'expliquer aussi le code à mettre que je me couche pas idiote ce soir
    Merci par avance

  2. #2
    Membre régulier
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juillet 2010
    Messages
    77
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Juillet 2010
    Messages : 77
    Points : 92
    Points
    92
    Par défaut
    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
     
     
     
    <?php
     
    	include ("../connexion.php");
     
    	$sqlquery="SELECT eid,subject FROM phpc_events ORDER BY eid";
    	$results= mysql_query($sqlquery);
     
    	if(isset($_GET['subject']))
    	{
    		$sqlaffich="SELECT phpc_occurrences.eid, phpc_occurrences.startdate, phpc_occurrences.enddate, phpc_occurrences.starttime, phpc_occurrences.endtime, phpc_events.eid, phpc_events.subject FROM phpc_occurrences, phpc_events WHERE phpc_occurrences.eid=phpc_events.eid AND phpc_occurrences.eid=".$_GET['subject'];
    		$res_affich=mysql_query($sqlaffich);
    		$row_affich=mysql_fetch_array($res_affich);
    	}
     
    	if(isset($_POST['inscription']) &&$_POST['inscription']==1)
    	{
    		//Requete d'inscription ou traitement de l'inscription et recuperation des POST
    	}	
     
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
    	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <head>
    	<title>S'inscrire à un cours</title>
    </head>
    <body>
    	<FORM NAME="a_them" ACTION="" METHOD="GET" >
    		<p class="adm_txtform">Choisir un thème :</p>
    				<SELECT name="subject">
    			<?php
    				while ($row=mysql_fetch_array($results))
    				{
    			?>
    				<OPTION value="<?php echo $row['eid'] ;?>"><?php echo $row['subject']; ?></OPTION>
    			<?php
    				}
    			?>				
    		</SELECT><br />
     
     
    		<INPUT TYPE="submit" VALUE="Valider" name="valid" id="ok">
     
    	</form>
     
    	<?php
    	if(isset($_GET['subject']))
    	{
    	?>
    		Date du cours : <?php echo $row_affich['startdate']; ?> Horaires : <?php echo $row_affich['starttime']; ?> à <?php echo $row_affich['endtime']; ?><br />
    		S'inscrire à ce cours ?
    		<form action="" method="post">
    		<input type="hidden" name="inscription" value="1"/>
     
    		<input type="hidden" name="date_cour" value="<?php echo $row_affich['startdate']; ?>"/>
    		<input type="hidden" name="horaire_debut" value="<?php echo $row_affich['starttime']; ?>"/>
    		<input type="hidden" name="horaire_fin" value="<?php echo $row_affich['endtime']; ?>"/>
     
    		<input type="submit" value="OUI (m'inscrire)" />
    		</form>
    	<?php
    	}
    	?>
    </body>
    </html>

    Test ça je pense que c'est ce que tu veux !!


    Fred75

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    107
    Détails du profil
    Informations personnelles :
    Âge : 48
    Localisation : France, Pyrénées Orientales (Languedoc Roussillon)

    Informations forums :
    Inscription : Avril 2006
    Messages : 107
    Points : 70
    Points
    70
    Par défaut
    Je te remercie, je vois la subtilité maintenant :p J'ai pas pensé à faire un form tout simplement avec un bouton submit... effectivement vu comme ça tout devient plus simple ^^

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

Discussions similaires

  1. [Outlook] Faire communiquer mon application php avec MS Outlook
    Par carnifex dans le forum Bibliothèques et frameworks
    Réponses: 3
    Dernier message: 01/02/2012, 09h08
  2. Réponses: 12
    Dernier message: 05/06/2009, 22h01
  3. Faire communiquer Php et Mssql server
    Par kamnouz dans le forum Outils
    Réponses: 1
    Dernier message: 12/04/2009, 09h42
  4. Faire communiquer Delphi avec un serveur php
    Par Caesarus dans le forum Web & réseau
    Réponses: 2
    Dernier message: 30/10/2008, 11h43

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