Salut tout le monde,
Je veux créer un formulaire qui permet de générer un fichier CSS.
Voila mes codes:
index.php:
css.php:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <html> <head> <title>Personnaliser votre thème</title> <script type="text/javascript" src="jquery-1.4.2.js"></script> <script type="text/javascript" src="jscolor/jscolor.js"></script> <script type="text/javascript"> $().ready(function() { $("#save").bind('click', function() { var css,bgcol,photo,sizetext,textcol; bgcol = "#"+$("#bgcol").val(); photo = $("#photo").val(); sizetext = $("#sizetext").val()+'em'; alert(sizetext); textcol = "#"+$("#textcol").val(); //css = "body{background-color:"+bgcol+";font-size:"+sizetext+";color:"+textcol+";background-image:url("+photo+");}"; //alert(css); $.ajax({ url : "css.php", data : "bgcol="+bgcol+"&sizetext="+sizetext+"&textcol="+textcol+"&photo="+photo, success : function(data) { if(data == 0) { alert('ok'); } } }); //$("body").css('background-color',bgcol).css('font-size',sizetext).css('color',textcol).css('background-image','url('+photo+')'); }); }); </script> </head> <body> <table> <tr><td>Couleur arriere-plan </td><td><input type="text" id="bgcol" class="color"/></td></tr> <tr><td>Transfère le fichier </td><td> <input type="file" id="photo" /></td></tr> <tr><td>Taille texte </td><td><input type="text" id="sizetext"/></td></tr> <tr><td>Couleur texte </td><td><input type="text" id="textcol" class="color"/></td></tr> <tr><td><input type="button" value="Appliquer" id="save"/></td><td></td></tr> </table> Bonjour tout le monde, C'est un teste pour changer le style de a page. On essaye de donner un moyen aux utilisateurs de choisir le design qui leurs convient. </body> </html>
ça me pose le problème suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 <?php $bgcol = $_GET['bgcol']; $sizetext = $_GET['sizetext']; $textcol = $_GET['textcol']; $photo = $_GET['photo']; $css = "body{background-color:".$bgcol.";font-size:".$sizetext.";color:".$textcol.";background-image:url(".$photo.");}"; //echo $css; $monfichier = fopen('style.css', 'r+'); fputs($monfichier, $css); echo 0; ?>
br />
<b>Notice</b>: Undefined index: sizetext in <b>C:\Program Files\Apache Group\Apache2\htdocs\roller\css.php</b> on line <b>3</b><br />
<br />
<b>Notice</b>: Undefined index: textcol in <b>C:\Program Files\Apache Group\Apache2\htdocs\roller\css.php</b> on line <b>4</b><br />
<br />
<b>Notice</b>: Undefined index: photo in <b>C:\Program Files\Apache Group\Apache2\htdocs\roller\css.php</b> on line <b>5</b><br />
pourquoi les valeurs ne sont pas envoyées au fichier css.php? je ne vois poa où est ma faute?
Partager