PHP &

2 Cevap php

How do I set this up so that I can manipulate $backgroundcolor = "#00FFFF"; on another .php file?

Initially I just want to be able to change the value of the $backgroundcolor ="#00FFFF"; From another form that is hrefed to this form (style.php) based on user input.

I Tried this on this form so that I could hopefully give $backgroundcolor different values: $backgroundcolor = " ";

. Sonra = "hiçbir sonuç ile bazı farklı onaltılık renk" $ backgroundcolor aramak için bu style.php script hrefed başka bir php formu kullanılır;

In fact all I saw was the output of the value #0033FF, but I don't want the output, I want the new value #0033FF to be the background color?

<?php header("Content-type: text/css"); 
$backgroundcolor = "#00FFFF ";
$textcolor = " #0033FF";
?>
body {
 background:<?php  echo $backgroundcolor?>;
 color:<?php echo $textcolor?>;
}

2 Cevap

Php tarafında bu kullanın:

Fikir, bu gibi tüm css ve php kod kurulum almak için:

$ Backgroundcolor = $ _REQUEST ["backgroundcolor"];

background-color: $ backgroundcolor;

Background-color Nerede: size geleneksel CSS arka plan rengini verecek, biz bu durumda $ backgroundColor olarak, bir değişken ile kullanmak olacaktır;

Html tarafı biz böyle bir formu olacak:

<select name = "backgroundcolor">
<option value = "#000000">Black</option>
<!-- And all we have to do is add multiple options for the different color values      
and the php script will do the rest after the user has selected 
the color he or she wants, done-->


#heredoc
$theStyle = <<<HERE
"border-width:$borderSize$sizeType;
background-color: $ backgroundcolor;
color:$fontcolor;
border-style:$borderStyle;
border-color:green"
HERE;

Kullanılacak sessions, cookies, databases. Olabilir

Ne yapmaya çalışıyorsun istekleri ile bazı verileri devam etmektir.

Sen arka plan saklamak zorunda & size kolaylık metin rengi yerde.