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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
| <!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>sans titre 1</title>
<script language="javascript">
function create_champ(){
var item = document.getElementsByTagName("div")[1];
var clone = item.cloneNode(true);
document.body.appendChild(clone);
}
function supprime_champ(){
var cpt = parseInt(document.getElementById('nombre').value);
cpt--;
var parent = document.getElementById('zone_dynamique');
var NodeListe = parent.getElementsByTagName("div");
if( NodeListe.length >= 2 ){
var Enfant=NodeListe[NodeListe.length-1]
parent.removeChild(Enfant);
document.getElementById('nombre').value = cpt;
}
}
-->
</script>
<script>
function choixChange(obj){
var valeur = obj.value;
var paragraphe = document.getElementById("paragrapheSupplementaire");
paragraphe.innerHTML="";
if (valeur == "liste" || valeur == "bouton"){
paragraphe.innerHTML+="<label>Rentrez les informations:</label>"
+'<input name=sous_choix type="text">';
/*+'<select name="orientation" id="orientation">'
+'<option value="LP">LP</option>'
+'<option value="master">master</option>'
+'<option value="inge">Ecole d\'ingé</option>'
+'<option value="boulot">Boulot</option>'
+'<option value="autre">Autre</option>'
+'</select>';*/
}
}
choixChange();
</script>
<script language="javascript">
function confirme( identifiant )
{
var confirmation = confirm( "Voulez vous vraiment supprimer cet enregistrement ?" ) ;
if( confirmation )
{
document.location.href = "suppression2.php?id_test="+identifiant ;
}
}
</script>
</head>
<body>
<?php
$serveur = "localhost";
$base = "xxxx";
$user = "root";
$pass = "xxxx";
$mysqli = new mysqli($serveur, $user, $pass, $base);
$mysqli->set_charset("utf8");
if ($mysqli->connect_error) {
die('Erreur de connexion ('.$mysqli->connect_errno.')'. $mysqli->connect_error);
}
else {
//echo 'connexion réussie : '.$mysqli->host_info .'</br>';
}
$sql = '
SELECT *
FROM `test23` f
JOIN `titre23` t ON f.`id_titre` = t.`id_titre`
';
$result = $mysqli->query($sql);
?>
<table cellspacing="0" cellpadding="3px" rules="rows" style="border:solid 1px #777777; border-collapse:collapse; font-family:verdana; font-size:11px;">
<tr style="background-color:lightgrey;">
<th style="width:100px;">Nom</th>
<th style="width:100px;">Valeur_champ</th>
<th style="width:100px;">Sous champ</th>
<th style="width:100px;">Modifier</th>
<th style="width:100px;">Supprimer</th>
</tr>
<?php
while($data = $result->fetch_array())
{
echo $data['id_titre'];
$titre = $data['nom_titre'];
?>
<tr>
<td style="padding-left:10px; color:midnightblue;"><?php echo $data['nom_test']; ?></td>
<td style="padding-left:10px; color:midnightblue;"><?php echo $data['choix_test']; ?></td>
<td style="padding-left:10px; color:midnightblue;"><?php echo $data['sous_choix']; ?></td>
<td>
<?php echo( "<a href=\"modification2.php?id_test=".$data['id_test']."\">Modifier</a></div>") ; ?>
</td>
<td>
<?php echo( "<a href=\"#\" onClick=\"confirme('".$data['id_test']."')\" >Supprimer</a><br>") ; ?>
</td>
</tr>
<?php
}
?>
</table>
<fieldset name="test">
<legend><?php echo $titre; ?></legend>
<form id="id_test" name="test23[]" method="post" action="test_traitement23.php">
<!--Nombre de champs : <input name="nombre" id="nombre" type="text" value="1" size="3">-->
<div id="zone_dynamique">
<div id="test" align="left">
Nom du champ:
<input name="nom_test" type="text"/>
Choix : <select name="choix_test" id="choix" onchange='choixChange(this);'>
<option value="test" selected="selected">Choisir un type</option>
<option value="champ_texte">Champ de texte</option>
<option value="zone_email">Zone d'adresse e-mail</option>
<option value="liste">Liste déroulante</option>
<option value="bouton">Boutons radio</option>
<option value="case">Cases à cocher</option>
<option value="zone_texte">Zone de texte</option>
</select>
</div>
<div id="paragrapheSupplementaire">
</div>
</div>
<div id="button">
<!--<input type="button" onClick="javascript:create_champ()" value="Insérer un autre champ"/>-->
<input type="submit" value="envoyer" name="valider"/>
</div>
</form>
</fieldset>
<?php
$result->close();
$mysqli->close();
?>
</body>
</html> |
Partager