runeberg1 Posted December 5, 2007 Share Posted December 5, 2007 Hello! I'm new to the php language. I'm working on a school project where we are building a small CMS. This is the "Choos Design" area. It works with writing to file "design.db" from admin area and the public web page reads css from content in "design.db" Currently it is working with two different designs in css, black and white. Now I need the part, something like: If content in $DesignFile = "black.css" then $black_status = 'checked' in form. Status now: If nothing is checked then the file "design.db" gets "empty" and therefore no css on main public area. <? $DesignFile = "include/design.db"; $Handle = fopen($DesignFile, 'w'); $BlackData = "black.css"; $WhiteData = "white.css"; if (isset($_POST['Set_design'])) { $black_status = 'unchecked'; $white_status = 'unchecked'; $selected_radio = $_POST['design']; if ($selected_radio == 'black') { $black_status = 'checked'; fwrite($Handle, $BlackData); } else if ($selected_radio == 'white') { $black_status = 'checked'; fwrite($Handle, $WhiteData); } } fclose($Handle); ?> <FORM NAME ="form1" METHOD ="POST" ACTION ="choose_design.php"> <INPUT TYPE = 'Radio' Name ='design' value= 'sort' <?PHP print $black_status; ?>>Sort <INPUT TYPE = 'Radio' Name ='design' value= 'hvid' <?PHP print $white_status; ?>>Hvid <P> <INPUT TYPE = "Submit" Name = "Set_design" VALUE = "Vælg design" style=" background-color: #000000; color: #FFFFFF;"> </FORM> I really hope you can help me. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.