Textfield html
Anoso
Messages postés
185
Statut
Membre
-
avion-f16 Messages postés 20367 Statut Contributeur -
avion-f16 Messages postés 20367 Statut Contributeur -
salut à tous j fais ce morceau de code qui affiche le contenue du champs texte aprés clic sur bouton envoyer mais j remarqué que ce champs sera automatiquement vide aprés clic sur bouton ,ma question ya t'il un moyen pour que le champs de texte garde son contenue aprés clic sur envoyer:
<body>
<label></label>
<form id="form1" name="form1" method="post" >
<input type="text" name="textfield" checked="checked" />
<label>
<input type="submit" name="Submit" value="Envoyer" />
</label>
</form>
<?php
$x=$_POST['textfield'];
if (isset($_POST['Submit']))
{
switch($_POST['Submit']){
case "Envoyer": echo $x;
break;
}
}
?>
</body
<body>
<label></label>
<form id="form1" name="form1" method="post" >
<input type="text" name="textfield" checked="checked" />
<label>
<input type="submit" name="Submit" value="Envoyer" />
</label>
</form>
<?php
$x=$_POST['textfield'];
if (isset($_POST['Submit']))
{
switch($_POST['Submit']){
case "Envoyer": echo $x;
break;
}
}
?>
</body
A voir également:
- Textfield html
- Editeur html - Télécharger - HTML
- Espace en html ✓ - Forum HTML
- [**] Balise pour un espace vide en hml. Merci ✓ - Forum Webmastering
- Nbsp html ✓ - Forum Webmastering
- Html download - Télécharger - HTML
2 réponses
C'est un peu n'importe quoi ton formulaire ...
Tu m'expliqueras comment on peut cocher un champ texte, et à quoi sert la balise <label> vide ...
Et le code PHP :
Tu m'expliqueras comment on peut cocher un champ texte, et à quoi sert la balise <label> vide ...
<form method="post" action="">
<p>
<label for="champ1">Champ 1 :</label>
<input type="text" name="champ1" id="champ1" <?php if(isset($_POST['champ1'])) echo 'value="'.$_POST['champ1'].'" '; ?>/>
</p>
<p>
<input type="submit" value="Envoyer" />
</p>
</form>
Et le code PHP :
<?php
if(isset($_POST['champ1']))
echo $_POST['champ1'];
?>
<body>
<form id="form1" name="form1" method="post" >
<input type="text" name="textfield" />
<label>
<input type="submit" name="Submit" value="Envoyer" />
</label>
</form>
<?php
$x=$_POST['textfield'];
if (isset($_POST['Submit']))
{
switch($_POST['Submit']){
case "Envoyer": echo $x;
break;
}
}
?>
</body
<form id="form1" name="form1" method="post" >
<input type="text" name="textfield" />
<label>
<input type="submit" name="Submit" value="Envoyer" />
</label>
</form>
<?php
$x=$_POST['textfield'];
if (isset($_POST['Submit']))
{
switch($_POST['Submit']){
case "Envoyer": echo $x;
break;
}
}
?>
</body