Probleme bouton submit en PHP
tsii
Messages postés
96
Date d'inscription
Statut
Membre
Dernière intervention
-
Mickaël -
Mickaël -
Voici un autre probleme :
mes bouton radio utilise deja le submit pour faire un affichage dynamique sur la meme page .
maintenant il se trouve que j'ai un bouton valide et j'aimerai qu'il puisse appelé et executé un autre fichier php tout en gardant les valeur des variable.
Merci
mes bouton radio utilise deja le submit pour faire un affichage dynamique sur la meme page .
maintenant il se trouve que j'ai un bouton valide et j'aimerai qu'il puisse appelé et executé un autre fichier php tout en gardant les valeur des variable.
Merci
A voir également:
- Probleme bouton submit en PHP
- Easy php - Télécharger - Divers Web & Internet
- Bouton reinitialisation pc - Guide
- Diagnostic bouton photo - Accueil - Outils
- Bouton on/off comment savoir ✓ - Forum Matériel & Système
- Symbole arrêt marche - Forum Word
34 réponses
tu peux faire par exemple
--------------------------------------------------------
L'informatique est un long fleuve pas tranquille !!!
var var1 = " <?echo $var1?> ";
--------------------------------------------------------
L'informatique est un long fleuve pas tranquille !!!
Mais dit moi , je pense que c mieux de le faire en php, defenir une fonction en php et au moment ou je clic sur le bouton, ej lui passe en parametre les variable et la fonction fera le traitement ?
comment defini on une fonction en php ?
et comment l'appelé en lui passant des parametre ?
comment defini on une fonction en php ?
et comment l'appelé en lui passant des parametre ?
Tu peux pas faire ca. Si tu veux appeler une fonction en PHP il faut obligatoirement recharger la page.
--------------------------------------------------------
L'informatique est un long fleuve pas tranquille !!!
--------------------------------------------------------
L'informatique est un long fleuve pas tranquille !!!
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
mais ca me pose pas de probleme de recharger la page ?
ok je voit que je me suis mal exprimé , les bouton radio recharge la page mais mon bouton validé me fait un traitement suplementaire ,
alors si tu peut me dire comment faire la fonction en php et l'appelé ?
ok je voit que je me suis mal exprimé , les bouton radio recharge la page mais mon bouton validé me fait un traitement suplementaire ,
alors si tu peut me dire comment faire la fonction en php et l'appelé ?
Oui mais si tu recharge la page tu perds tous les choix que l'utilisateur a fait (a moins de les reselectionner quand tu reecrit le code html)
--------------------------------------------------------
L'informatique est un long fleuve pas tranquille !!!
--------------------------------------------------------
L'informatique est un long fleuve pas tranquille !!!
ouais mais lors de l'appel de fonction je peut lui passé en parametre des valeurs ?
tu peut me dire poof65 comment appelé une fonction php au moment du clic sur le bouton ?
tu peut me dire poof65 comment appelé une fonction php au moment du clic sur le bouton ?
Ben tu mets un <input type="hidden" name="fonction" value="ok" />
et dans ta page tu fais un if (isset($_POST['fonction'))fonction_qui_tue();
--------------------------------------------------------
L'informatique est un long fleuve pas tranquille !!!
et dans ta page tu fais un if (isset($_POST['fonction'))fonction_qui_tue();
--------------------------------------------------------
L'informatique est un long fleuve pas tranquille !!!
j'ai fait ca et ca ne marche pas pourkoi ?
....
....
....
if (isset($_POST['fonction']))
result();
Function result()
{
echo "ouais ouais !";
}
?>
</tr>
</table>
</table>
<table>
<tr>
<input type="hidden" name="fonction" value="valider" />
</tr>
</table>
....
....
....
if (isset($_POST['fonction']))
result();
Function result()
{
echo "ouais ouais !";
}
?>
</tr>
</table>
</table>
<table>
<tr>
<input type="hidden" name="fonction" value="valider" />
</tr>
</table>
et le hidden ? et le form ?
--------------------------------------------------------
L'informatique est un long fleuve pas tranquille !!!
--------------------------------------------------------
L'informatique est un long fleuve pas tranquille !!!
bijour,
Voila j'ai été interessé par votre discussion et j'aurai voulu savoir comment differencier plusieurs submit qui appelent la même page ...
Y'a eu des éléments de réponse mais un exemple concret avec 2 submit executant deux codes php differents situé sur la meme page serait le bien venu ;)
a+
michel
Voila j'ai été interessé par votre discussion et j'aurai voulu savoir comment differencier plusieurs submit qui appelent la même page ...
Y'a eu des éléments de réponse mais un exemple concret avec 2 submit executant deux codes php differents situé sur la meme page serait le bien venu ;)
a+
michel
Slt !
Si tes 2 boutons submit sont dans 2 formulaire différents sur ta première page, tu mets un variable invisible (hidden) qui porte le meme nom dans chaque formulaire mais tu les affectes de 2 valeurs différentes.
Sur ta deuxième page où se trouve tes 2 codes différents tu n 'a plus qu'a tester cette variable avec un if {} pour executer le premier ou le deuxieme code.
Si tes 2 boutons submit sont dans 2 formulaire différents sur ta première page, tu mets un variable invisible (hidden) qui porte le meme nom dans chaque formulaire mais tu les affectes de 2 valeurs différentes.
Sur ta deuxième page où se trouve tes 2 codes différents tu n 'a plus qu'a tester cette variable avec un if {} pour executer le premier ou le deuxieme code.
<form><input type="button" value="valider" onclick="fonction(this.form)" /></form>
<script>
function fonction (f)
{
var equip = blablabla;
var format = blablabla;
var date = blablabla;
window.open('resultats.php?equip='+equip+'&format='+format+'&date='+date);
}
</script>
--------------------------------------------------------
L'informatique est un long fleuve pas tranquille !!!
<script>
function fonction (f)
{
var equip = blablabla;
var format = blablabla;
var date = blablabla;
window.open('resultats.php?equip='+equip+'&format='+format+'&date='+date);
}
</script>
--------------------------------------------------------
L'informatique est un long fleuve pas tranquille !!!
Ok je voi ce que tu veut dire mais je voi pas comment l'implementer car il y aurau n probleme au niveau des variable ?
voici mon code :
<html>
<head>
<title>
</title>
</head>
<body>
<form Action="index.php" Method="POST">
<table border="0" width="400" align="center">
<tr>
<td width="100"><b>Equipement</b></td>
<?php
$equipement = file ('liste_equipement.TXT');
echo '<td><select>';
foreach ($equipement as $i)
echo '<option>'.$i.'</option>';
echo '</select></td>';
if (!(isset($_POST['chx'])))
{
echo '</tr></table><center><table><tr>';
echo '<td><input type="radio" name="chx" value="day" checked onclick="this.form.submit()" />Day</td>';
echo '<td><input type="radio" name="chx" value="week" onclick="this.form.submit()" />Week </td>';
echo '<td><input type="radio" name="chx" value="month" onclick="this.form.submit()" />Month </td>';
echo '<td><input type="radio" name="chx" value="year" onclick="this.form.submit()" />Year </td>';
echo '</tr>';
echo '</table>';
}
else
{
if($_POST['chx']=="day")
{
echo '</tr></table><center><table><tr>';
echo '<td><input type="radio" name="chx" value="day" checked onclick="this.form.submit()" />Day</td>';
echo '<td><input type="radio" name="chx" value="week" onclick="this.form.submit()" />Week</td>';
echo '<td><input type="radio" name="chx" value="month" onclick="this.form.submit()" />Month </td>';
echo '<td><input type="radio" name="chx" value="year" onclick="this.form.submit()" />Year </td>';
echo '</tr>';
echo '</table>';
echo '<table><tr><td><b>Jour</b></td><td><select>';
for($cpt=1;$cpt<32;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
echo '<td><b>Mois</b></td><td><select>';
for($cpt=1;$cpt<13;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
echo '<td><b>Année 20 </b></td><td><select>';
for($cpt=0;$cpt<101;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
}
if($_POST['chx']=="week")
{
echo '</tr></table><center><table><tr>';
echo '<td><input type="radio" name="chx" value="day" onclick="this.form.submit()" />Day</td>';
echo '<td><input type="radio" name="chx" value="week"checked onclick="this.form.submit()" />Week </td>';
echo '<td><input type="radio" name="chx" value="month" onclick="this.form.submit()" />Month </td>';
echo '<td><input type="radio" name="chx" value="year" onclick="this.form.submit()" />Year </td>';
echo '</tr>';
echo '</table>';
echo '<td><b>Semaine</b></td><td><select>';
for($cpt=1;$cpt<53;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
echo '<td><b>Année 20 </b></td><td><select>';
for($cpt=0;$cpt<101;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
}
if($_POST['chx']=="month")
{
echo '</tr></table><center><table><tr>';
echo '<td><input type="radio" name="chx" value="day" onclick="this.form.submit()" />Day</td>';
echo '<td><input type="radio" name="chx" value="week" onclick="this.form.submit()" />Week </td>';
echo '<td><input type="radio" name="chx" value="month" checked onclick="this.form.submit()" />Month </td>';
echo '<td><input type="radio" name="chx" value="year" onclick="this.form.submit()" />Year </td>';
echo '</tr>';
echo '</table>';
echo '<td><b>Mois</b></td><td><select>';
for($cpt=01;$cpt<13;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
echo '<td><b>Année 20 </b></td><td><select>';
for($cpt=00;$cpt<101;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
}
if($_POST['chx']=="year")
{
echo '</tr></table><center><table><tr>';
echo '<td><input type="radio" name="chx" value="day" onclick="this.form.submit()" />Day</td>';
echo '<td><input type="radio" name="chx" value="week" onclick="this.form.submit()" />Week </td>';
echo '<td><input type="radio" name="chx" value="month" onclick="this.form.submit()" />Month </td>';
echo '<td><input type="radio" name="chx" value="year" checked onclick="this.form.submit()" />Year </td>';
echo '</tr>';
echo '</table>';
echo '<td><b>Année 20 </b></td><td><select>';
for($cpt=00;$cpt<101;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
}
}
?>
</tr>
</table>
</table>
<table>
<tr>
<input type="submit" value="Valider"> // Bouton doit me permmetre d'afficher un resultat
</tr>
</table>
</body>
</html>
voici mon code :
<html>
<head>
<title>
</title>
</head>
<body>
<form Action="index.php" Method="POST">
<table border="0" width="400" align="center">
<tr>
<td width="100"><b>Equipement</b></td>
<?php
$equipement = file ('liste_equipement.TXT');
echo '<td><select>';
foreach ($equipement as $i)
echo '<option>'.$i.'</option>';
echo '</select></td>';
if (!(isset($_POST['chx'])))
{
echo '</tr></table><center><table><tr>';
echo '<td><input type="radio" name="chx" value="day" checked onclick="this.form.submit()" />Day</td>';
echo '<td><input type="radio" name="chx" value="week" onclick="this.form.submit()" />Week </td>';
echo '<td><input type="radio" name="chx" value="month" onclick="this.form.submit()" />Month </td>';
echo '<td><input type="radio" name="chx" value="year" onclick="this.form.submit()" />Year </td>';
echo '</tr>';
echo '</table>';
}
else
{
if($_POST['chx']=="day")
{
echo '</tr></table><center><table><tr>';
echo '<td><input type="radio" name="chx" value="day" checked onclick="this.form.submit()" />Day</td>';
echo '<td><input type="radio" name="chx" value="week" onclick="this.form.submit()" />Week</td>';
echo '<td><input type="radio" name="chx" value="month" onclick="this.form.submit()" />Month </td>';
echo '<td><input type="radio" name="chx" value="year" onclick="this.form.submit()" />Year </td>';
echo '</tr>';
echo '</table>';
echo '<table><tr><td><b>Jour</b></td><td><select>';
for($cpt=1;$cpt<32;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
echo '<td><b>Mois</b></td><td><select>';
for($cpt=1;$cpt<13;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
echo '<td><b>Année 20 </b></td><td><select>';
for($cpt=0;$cpt<101;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
}
if($_POST['chx']=="week")
{
echo '</tr></table><center><table><tr>';
echo '<td><input type="radio" name="chx" value="day" onclick="this.form.submit()" />Day</td>';
echo '<td><input type="radio" name="chx" value="week"checked onclick="this.form.submit()" />Week </td>';
echo '<td><input type="radio" name="chx" value="month" onclick="this.form.submit()" />Month </td>';
echo '<td><input type="radio" name="chx" value="year" onclick="this.form.submit()" />Year </td>';
echo '</tr>';
echo '</table>';
echo '<td><b>Semaine</b></td><td><select>';
for($cpt=1;$cpt<53;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
echo '<td><b>Année 20 </b></td><td><select>';
for($cpt=0;$cpt<101;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
}
if($_POST['chx']=="month")
{
echo '</tr></table><center><table><tr>';
echo '<td><input type="radio" name="chx" value="day" onclick="this.form.submit()" />Day</td>';
echo '<td><input type="radio" name="chx" value="week" onclick="this.form.submit()" />Week </td>';
echo '<td><input type="radio" name="chx" value="month" checked onclick="this.form.submit()" />Month </td>';
echo '<td><input type="radio" name="chx" value="year" onclick="this.form.submit()" />Year </td>';
echo '</tr>';
echo '</table>';
echo '<td><b>Mois</b></td><td><select>';
for($cpt=01;$cpt<13;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
echo '<td><b>Année 20 </b></td><td><select>';
for($cpt=00;$cpt<101;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
}
if($_POST['chx']=="year")
{
echo '</tr></table><center><table><tr>';
echo '<td><input type="radio" name="chx" value="day" onclick="this.form.submit()" />Day</td>';
echo '<td><input type="radio" name="chx" value="week" onclick="this.form.submit()" />Week </td>';
echo '<td><input type="radio" name="chx" value="month" onclick="this.form.submit()" />Month </td>';
echo '<td><input type="radio" name="chx" value="year" checked onclick="this.form.submit()" />Year </td>';
echo '</tr>';
echo '</table>';
echo '<td><b>Année 20 </b></td><td><select>';
for($cpt=00;$cpt<101;$cpt++)
{
if( $cpt < 10)
echo '<option>0'.$cpt.'</option>';
else
echo '<option>'.$cpt.'</option>';
}
echo '</select></td>';
}
}
?>
</tr>
</table>
</table>
<table>
<tr>
<input type="submit" value="Valider"> // Bouton doit me permmetre d'afficher un resultat
</tr>
</table>
</body>
</html>