whats wrong with my php code? plzz help me!
Posted: Tue Feb 13, 2007 12:49 am
feyd | Please use
style.php
the problem is when i set the value of bg= #000023 in zz.php. it can't read the '#' sign. the output that i got such as below:-
body { background:; color:#333; } h1, h2, h3, h4 { color:#008400; } blockquote { color:#008400; }
then, i try to remove the '#'. but the background color still not change. the output such as below:-
000023 body { background:000023; color:#333; } h1, h2, h3, h4 { color:#008400; } blockquote { color:#008400; }
plzz help me..i didn't know what to do. i still work on it but can't find where is the error.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
i wrote the code to allow user change the background color for my system. the color picker is write in javascript. but i have some problem with my .php files.
file zz.phpCode: Select all
<?php
$bgColor = $_POST['backColor'];
echo $bgColor;
?>
<link rel="stylesheet" type="text/css"
media="screen" href="style.php">
<script language="JavaScript">
function BtnOkClicked()
{
document.getElementById("bgCol".value = SEL_COLOR;
}
</script>
<html>
<body>
<form method="post" action="style.php?bg=000023">
<div class="divSection">
<br>BACKGROUND:<br>
Choose A color: <input type="text" id="bgCol" size="12"><input type="button" value="..." onclick="ShowLayer();"><BR>
<br><br>
<input name="change" type="submit" value="Change Now">
<!--COLOR PICKER WIDGET BEGIN -->
<div style="position:absolute;border:1px solid black;background-color:white;display:none;width:337px;height:375px;" id="main" imgLoc="./">
</div>
<script language="JavaScript" src="cpick.js"></script>
<!--COLOR PICKER WIDGET END -->
</form>
</body>
</html>Code: Select all
<?php
$id = $_GET['bg'];
echo $id;
$white = $id;
$dkgray = '#333444';
$dkgreen = '#008400';
?>
body {
background:<?=$white?>;
color:<?=$dkgray?>;
}
h1, h2, h3, h4 {
color:<?=$dkgreen?>;
}
blockquote {
color:<?=$dkgreen?>;
}body { background:; color:#333; } h1, h2, h3, h4 { color:#008400; } blockquote { color:#008400; }
then, i try to remove the '#'. but the background color still not change. the output such as below:-
000023 body { background:000023; color:#333; } h1, h2, h3, h4 { color:#008400; } blockquote { color:#008400; }
plzz help me..i didn't know what to do. i still work on it but can't find where is the error.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]