Location: PHPKode > scripts > CSS Briefcase > css-briefcase/add-style.php
<?php
	include('functions.php');
	
	if ($_POST['action'] == 'add_style') {
		$code = clean_content($_POST['style_code']);
		$xml_entry = 
'<style>
	<name>' . $_POST['name'] . '</name>
	<style_code>' . $code . '</style_code>
</style>';
		$contents = getFileContents('css.xml');
		@unlink('css.xml');
		$file = fopen('css.xml','w+');
		fwrite($file,$contents . "\n" . $xml_entry);
		$result_div = '<div class="result-div">Your style was added to the briefcase</div>';
	}

?>
<html>
<head>
<style>
	.result-div {
		border:1px solid silver;
		padding:5px;
		text-align:center;
		margin:5px;
		color:#009900;
		font-weight:bold;
	}
</style>

<link rel="stylesheet" type="text/css" href="styles.css"></link>
</head>
<body>
<?php echo $result_div; ?>
<h1>Add CSS Style to Briefcase</h1>
<p><a href="index.php"><strong>&lt;&lt; Return to your CSS briefcase</strong></a></p>
<form action="add-style.php" method="post">
	<input type="hidden" name="action" value="add_style" />
	Nickname: <input type="text" size="40" name="name" /><br />
	CSS Code:<br />
	<textarea name="style_code" cols="60" rows="12"></textarea><br />
	<input type="submit" value="Add Style" />
</form>
<p><a href="http://www.impliedbydesign.com/css-briefcase.html">CSS Briefcase</a> is a free script offered by <a href="http://www.impliedbydesign.com">Implied By Design LLC.</a></p>
</body>
</html>
Return current item: CSS Briefcase