Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Général Conception Web > Débuter
Débuter Forum d'entraide pour débuter dans la création de sites Web
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 10/07/2011, 18h21   #1
Débutant
 
Avatar de ETVigan
 
Homme Esteban
Conseil - Consultant en systèmes d'information
Inscription : avril 2010
Messages : 632
Détails du profil
Informations personnelles :
Nom : Homme Esteban
Localisation : France, Gard (Languedoc Roussillon)

Informations professionnelles :
Activité : Conseil - Consultant en systèmes d'information
Secteur : Finance

Informations forums :
Inscription : avril 2010
Messages : 632
Points : 122
Points : 122
Envoyer un message via MSN à ETVigan Envoyer un message via Skype™ à ETVigan
Par défaut Problème alignement d'un formulaire

Bonjour,

J'ai un souci avec un formulaire dans lequel il y a un champ VILLE
Si le ZIPCODE et/ou le PAYS a changé, je fais une recherche (qui fonctionne)
Le souci est que si je fais une recherche, je la fais dans un champ et que l'affichage de la ville se fait aussi dans un champ !
L'idéal serait que les 2 champs fusionnent et soient à la même place, ce qui n'est pas le cas et je ne comprends pas pourquoi ....
Voici mon code:

Code :
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
<tr>
      <td colspan="2">
		<div align="center">
			<span class="form_lbl">Code postal</span>
			<span class="fld_mandatory">*</span>
			<br/>	
   			<?php		
 				$oldzip = (isset($_POST['zip'])) ? isset($_POST['zip']) : 0 ;
			?>
			<input name="zip" type="text"  size="5" maxlength="5" 
	                <?php if (isset($_POST['zip'])) echo 'value="'.$_POST['zip'].'"' ;  ?> />
                        <?php
	 			$newzip = (isset($_POST['zip'])) ? isset($_POST['zip']) : 0 ;
				B]$zip_changed = ($oldzip != $newzip) ? true : false ;			 [/B] 
			?>
      		</div>				
        </td>
      			
        <td width="83" align="center">
		<span class="form_lbl">Pays</span> 
                <span class="fld_mandatory">*</span> <br/>
   		<?php		
 			oldpays = (isset($_POST['pays'])) ? isset($_POST['pays']) : 0 ;
			form_select($sel_country , $name="pays" ) ; 
 			$newpays = (isset($_POST['pays'])) ? isset($_POST['pays']) : 0 ;
			$pays_changed = ($oldpays != $newpays) ? true : false ;			  
		?>   			  	
         </td>
      			
         <td width="57" align="center" valign="bottom">
      		<input name="infonmbr_city" type="submit" class="form_button" value="Ville" />
      	 </td>
      			
         <td>
		<div align="center">
			<span class="form_lbl">Ville </span>
			<span class="fld_mandatory">*</span>
			<br>
			<?php
                        	user_error("Pays changed[".$pays_changed."]" , E_USER_NOTICE) ;
                        	user_error("Zip  changed[".$zip_changed."]" , E_USER_NOTICE) ;
				$changed = $pays_changed OR $zip_changed ;
                        	user_error("changed[".$changed."]" , E_USER_NOTICE) ;
							
				if (!$changed)
					if (isset( $_POST["infonmbr_city"] ))
						{	echo "<select name='ville' id='ville'>\n";
							while($fetch = $this->dbInst->dbfetchAssoc($gu))
							{	$city = trim($fetch["Ville"]) ;
								if (strcmp($default,$city) == 0)
								        echo '  <option value="' . $city . '" selected">' . $city . "</option>\n" ;
								else
									echo '  <option value="' . $city . '"        -->' . $city . "</option>\n" ;  // Original
							}
							echo "</select>\n" ;
						}
					else ;					
 				else 
//					if (!changed && isset( $_POST["infonmbr_city"] ))
			?>
			<input name="city" type="text" value="<?php if (isset($_POST['Ville'])) echo $_POST['Ville']?>" size="25" maxlength="25" />
   	
                </div>				
	</td>
</tr>
En gras, le code du test de changement de pays ou de zip qui implique une recherche puis en bas, le code de recherche et l'affichage de la ville qu'il y ait eu recherche ou pas.....

J'ai un décalage vertical entre la zone de recherche et celle d'affichage.....

Ou est l'erreur de logique car du point de vue traitement, c'est OK !*

Merci à vous tous qui se pencheront sur ce petit problème




J'ai changé un poil mon code mais là, j'ai une erreur de parsing PHP

Code :
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
<div align="center">
	<span class="form_lbl">Ville </span>
	<span class="fld_mandatory">*</span>
	<br>
	<?php
                user_error("Pays changed[".$pays_changed."]" , E_USER_NOTICE) ;
                user_error("Zip  changed[".$zip_changed."]" , E_USER_NOTICE) ;
		$changed = $pays_changed OR $zip_changed ;
                user_error("changed[".$changed."]" , E_USER_NOTICE) ;
							
		if (!$changed)
			if (isset( $_POST["infonmbr_city"] ))
				{	echo "<select name='ville' id='ville'>\n";
					while($fetch = $this->dbInst->dbfetchAssoc($gu))
					{	$city = trim($fetch["Ville"]) ;
						if (strcmp($default,$city) == 0)
						        echo '  <option value="' . $city . '" selected">' . $city . "</option>\n" ;
						else
							echo '  <option value="' . $city . '"        -->' . $city . "</option>\n" ;  // Original
					}
					echo "</select>\n" ;
				}
			else 
			?>
				<input name="city" type="text" value="<?php if (isset($_POST['Ville'])) echo $_POST['Ville']?>" size="25" maxlength="25" />
                        <?php					
==>176 else 
			?>
			<input name="city" type="text" value="<?php if (isset($_POST['Ville'])) echo $_POST['Ville']?>" size="25" maxlength="25" />
   	</div>
L'erreur est la suivante:

Code :
1
2
Parse error:  syntax error, unexpected T_ELSE in F:\WebSites\jecrapahute 2010-08-21\form\infonmbr.php on line 176
J'abandonne pour ce soir....

Merci à vous tous
__________________
Esteban
ETVigan est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/07/2011, 19h25   #2
Débutant
 
Avatar de ETVigan
 
Homme Esteban
Conseil - Consultant en systèmes d'information
Inscription : avril 2010
Messages : 632
Détails du profil
Informations personnelles :
Nom : Homme Esteban
Localisation : France, Gard (Languedoc Roussillon)

Informations professionnelles :
Activité : Conseil - Consultant en systèmes d'information
Secteur : Finance

Informations forums :
Inscription : avril 2010
Messages : 632
Points : 122
Points : 122
Envoyer un message via MSN à ETVigan Envoyer un message via Skype™ à ETVigan
Par défaut Problème résolun question de parenthèses

Problème résolu:

Code :
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
					<div align="center">
						<span class="form_lbl">Ville </span>
						<span class="fld_mandatory">*</span>
						<br>
						<?php
                        	user_error("Pays changed[".$pays_changed."]" , E_USER_NOTICE) ;
                        	user_error("Zip  changed[".$zip_changed."]" , E_USER_NOTICE) ;
							$changed = $pays_changed OR $zip_changed ;
                        	user_error("changed[".$changed."]" , E_USER_NOTICE) ;
							
							if (!$changed)
								if (isset( $_POST["infonmbr_city"] ))
									{	echo "<select name='city' id='city'>\n";
										while($fetch = $this->dbInst->dbfetchAssoc($gu))
										{	$city = trim($fetch["Ville"]) ;
											if (strcmp($default,$city) == 0)
												echo '  <option value="' . $city . '" selected">' . $city . "</option>\n" ;
											else
												echo '  <option value="' . $city . '"        -->' . $city . "</option>\n" ;  // Original
										}
										echo "</select>\n" ;
									}
								else 
									{
						?>
								<input name="city" type="text" value="<?php if (isset($_POST['city'])) echo $_POST['city']?>" size="25" />
                        <?php		
									}			
 							else 
								{
						?>
							<input name="city" type="text" value="<?php if (isset($_POST['city'])) echo $_POST['city']?>" size="25" />
   			    		<?php
								}
						?>
Suffit d'ajouter des {et des } et cela à suffit....

Merci
__________________
Esteban
ETVigan est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 23h38.


 
 
 
 
Partenaires

Hébergement Web