My tagboard script


<?php 
if ($mode == "") {
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;&nbsp;</td>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table bgcolor="#000000" border="0" cellspacing="1" cellpadding="0">
<tr>
<td bgcolor="#333333">
<iframe name="tagwin" src="tag.phtml?mode=board" style="width:152px;height:150px" frameborder="0"></iframe>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<form action="tag.phtml?mode=board" method="post" target="tagwin">
<input type="hidden" name="submitted" value="true">
<input type="text" name="name" style="background-color:#333333;border:1px solid #000000;width:150px;font-family:verdana;font-size:8pt;color:#c0c0c0;" />
</td>
</tr>
<tr>
<td>
<textarea name="message" cols="17" rows="3" size="100" style="background-color:#333333;border:1px solid #000000;width:150px;height:50px;font-family:verdana;font-size:8pt;color:#c0c0c0;"></textarea>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Tag!" style="background-color:#333333;border:1px solid #000000;width:100px;font-family:verdana;font-size:8pt;color:#c0c0c0;">
<a href="tag.phtml?mode=board" target="tagwin">refresh</a>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php
}
if ($mode == "board") {
$fp = fopen('tag.txt', 'a+');

$contents = fgets($fp);
echo $contents;
if ($submitted == "true") {
$newtag = "&lt; $name &gt; $message <br>"; 
fputs($fp, $newtag);
fclose($fp);

$newtag = "";
$submitted = "false";
}
}
?>

That is my code. It is sloppy but oh well. I have to write to a test file becase do not have MySql access. It works just fine. Just wondering how to make the code more efficient… Just learning php and I want to know if that is good for a first program… I also made the text hit counter…

Go to http://www2.gmscripts.com/users/davidv0/index.phtml and click on the tagboard button to test it…

if your script works then its good enough.

When dealing with scripts this small, efficiency doesn’t really matter because there isn’t much to run. your code is fine. :slight_smile: