用PHP在首页MAIN.PHP中让用户自定义添加内容,有码求帮助
以下代码肯定有问题,试过了,我刚入门,求各位帮助!
我的思路是这样的:
先在MAIN.PHP中输入所有自定义内容的HTML代码,譬如用户可以自定添加至多2个内容快,A和B,我先在主页中写:
<div id="<?php echo $widgets1 ?>">A</div><div id="<?php echo $widgets2 ?>">B</div>然后在CSS中设置:[code=CSS]#a {display:none;}#b {display:none;}#a1 {}#b1 {} if(isset($_COOKIE['events'])) { $widgets1 = $_COOKIE['events']; } else { $widgets1 = "eventsshow"; } if(isset($_COOKIE['friends'])) { $widgets2 = $_COOKIE['friends']; } else { $widgets2 = "friendsshow"; } <fieldset> <legend>Widgets</legend> <input type="checkbox" value="eventsshow" <?php if($events == "eventsshow") echo "checked"; ?>></input> <label>events</label> <br/> <input type="checkbox" value="friendsshow" <?php if($friends == "friendsshow") echo "checked"; ?>></input> <label>friends</label> </fieldset> </form> <input type="submit">?>