Variable POST non transmise

Résolu
mont_dani Messages postés 229 Date d'inscription mardi 6 juin 2017 Statut Membre Dernière intervention 10 février 2024 - 13 nov. 2023 à 11:47
mont_dani Messages postés 229 Date d'inscription mardi 6 juin 2017 Statut Membre Dernière intervention 10 février 2024 - 14 nov. 2023 à 15:57

Bonjour

J ai une table sql qui definit les langues et pays en espagnol francais et anglais.

j'ai un fdorm quiva chercher les info en espagnol, un autre qui va chercher la meme info en francais et un autre en anglais.

mon form en espagnol focntionne bien mais ceux en francais et anglais envoie la variable $_POST['lang_elegido']; mais ne la recupere pas dans le form suivant.

Pour tester :https://km100.org/km100/trad/login.php

vocii le code des formulaire

celei en espagnol

	<form   method="post"  >
		
				<select style="width:300px; background-color: #FFBE33;border:none;" name="lang_elegido" >
					<option style="width:250px; background-color: #F5CC73; font-size:1.5 em;border:none;" value="">--Elige una opci&oacute;n--</option>
					<?php
					$sql_pais =  'SELECT DISTINCT(idioma) FROM cod_lenguaje_pais WHERE idioma !="" AND idioma !="0" ORDER BY idioma';
						foreach  ($sql->query($sql_pais) as $row)
						{
						echo '<option style="width:250px; background-color: #F5CC73; font-size:1.5em;border:none;" value="'.$row['idioma'].'">'.$row['idioma'].'</option>';
						}
					?>
				</select>
				
			
				<input style="width:50%; margin-left:25%; margin-right:25%;text-align:center; background-color: green; font-size:1.5em; border:none; color:white;" type="submit"  value="  ENVIAR  "/>
				
		</form>
		
				
		
	


	<form   method="post"  >
		
				<select style="width:300px; background-color: #FFBE33;" name="pais_elegido" >
					<option style="width:250px; background-color: #F5CC73; font-size:1.5em;" value="">--Elige una opci&oacute;n--</option>
					<?php
					if(isset($_POST['lang_elegido']))
						{$lang_select = $_POST['lang_elegido'];
					
						$sql_pais_2 =  'SELECT pais, idioma FROM cod_lenguaje_pais  WHERE pais !="" AND pais !="0"  AND idioma LIKE "%'.$_POST['lang_elegido'].'%" ORDER BY pais';
						$lang_elg = $_POST['lang_elegido'];
						foreach  ($sql->query($sql_pais_2) as $pais)
							{	
							echo '<option style="width:250px; background-color: #F5CC73; font-size:1.5em;" value="'.$pais['pais'].'">'.$pais['pais'].'</option> ';
							}
						}
						
					?>
				</select>
				
				<input style="width:50%; margin-left:25%; margin-right:25%; text-align:center; background-color: green; font-size:1.5em; border:none; color:white;" type="submit"  value="  ENVIAR  "/>
				
	</form>
	

et en francais

<form   method="post"  >
		
				<select style="width:300px; background-color: #FFBE33;border:none;" name="lang_elegido" >
					<option style="width:250px; background-color: #F5CC73; font-size:1.5 em;border:none;" value="">--Elige una opci&oacute;n--</option>
					<?php
					$sql_pais =  'SELECT DISTINCT(lang) FROM cod_lenguaje_pais WHERE lang !="" AND lang !="0" ORDER BY lang';
						foreach  ($sql->query($sql_pais) as $row)
						{
						echo '<option style="width:250px; background-color: #F5CC73; font-size:1.5em;border:none;" value="'.$row['lang'].'">'.$row['lang'].'</option>';
						}
					?>
				</select>
			
				<input style="width:50%; margin-left:25%; margin-right:25%;text-align:center; background-color: green; font-size:1.5em; border:none; color:white;" type="submit"  value="  ENVIAR  "/>
				
		</form>
		
				
		<?php  echo "langue select  ".$_POST['lang_elegido'];?>
	

<br>
	
	<form   method="post"  >
		
				<select style="width:300px; background-color: #FFBE33;" name="pais_elegido" >
					<option style="width:250px; background-color: #F5CC73; font-size:1.5em;" value="">--Elige una opci&oacute;n--</option>
					<?php
					 echo "langue select  ".$_POST['lang_elegido'];
					if(isset($_POST['lang_elegido']))
						{//$lang_select = $_POST['lang_elegido'];
					
						$sql_pais_2 =  'SELECT pais, idioma FROM cod_lenguaje_pais  WHERE pais !="" AND pais !="0"  AND idioma LIKE "%'.$_POST['lang_elegido'].'%" ORDER BY pais';
						$lang_elg = $_POST['lang_elegido'];
						foreach  ($sql->query($sql_pais_2) as $pais)
							{	
							echo '<option style="width:250px; background-color: #F5CC73; font-size:1.5em;" value="'.$pais['pais'].'">'.$pais['pais'].'</option> ';
							}
						}
						
					?>
				</select>
				
				<input style="width:50%; margin-left:25%; margin-right:25%; text-align:center; background-color: green; font-size:1.5em; border:none; color:white;" type="submit"  value="  ENVIAR  "/>
				
	</form>

et l a base de donnees

DROP TABLE IF EXISTS `cod_lenguaje_pais`;
CREATE TABLE IF NOT EXISTS `cod_lenguaje_pais` (
  `idx` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `code` varchar(5) DEFAULT NULL,
  `langue` varchar(60) DEFAULT NULL,
  `idioma` varchar(110) DEFAULT NULL,
  `pais` varchar(110) DEFAULT NULL,
  `lang` varchar(255) DEFAULT NULL,
  `pays` varchar(255) DEFAULT NULL,
  `language` varchar(255) DEFAULT NULL,
  `country` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`idx`),
  UNIQUE KEY `idx` (`idx`),
  UNIQUE KEY `cod_LP` (`code`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=260 DEFAULT CHARSET=utf8;

--
-- Déchargement des données de la table `cod_lenguaje_pais`
--

INSERT INTO `cod_lenguaje_pais` (`idx`, `code`, `langue`, `idioma`, `pais`, `lang`, `pays`, `language`, `country`) VALUES
(1, 'ar', 'árabe', '0', '0', '0', '0', '0', '0\r\n'),
(2, 'ar_AE', 'árabe [Emiratos Árabes Unidos]', 'árabe ', 'Emiratos Árabes Unidos', 'arabe\r\n', 'Emirats Arabes Unis', 'arab\r\n', 'United Arab Emirates'),
(3, 'ar_BH', 'árabe [Bahráin]', 'árabe ', 'Bahráin', 'Arabe\n', 'Bahrein\n', 'Arab\n', 'Bahrain\n'),
(4, 'ar_DZ', 'árabe [Argelia]', 'árabe ', 'Argelia', 'Arabe\n', 'Algerie\n', 'Arab\n', 'Algeria\n'),
(5, 'ar_EG', 'árabe [Egipto]', 'árabe ', 'Egipto', 'Arabe\n', 'Egypte\n', 'Arab\n', 'Egypt\n'),

Si quelqu'un pouvait m'expliquer pourqoui POST est recu dans un cas et pas dans l'autre.

merci d'avance.

Daniel

1 réponse

mont_dani Messages postés 229 Date d'inscription mardi 6 juin 2017 Statut Membre Dernière intervention 10 février 2024
14 nov. 2023 à 15:57

Probleme résolu. Il s'agissait  deun erreur de siaie dans les donnee: /n

0