Ok, I have a validation process form my form, (well i'm designing it but don't worry I got it)
The only problem is this:
My form is a comment form. I've got a brilliant plan on how to do this... but one step remains...
Ok, so I am using the switch content script... If you have ever worked with it you will notice that the content requires to be numbered properly...
here is the code with the pages...
File Name: 1.php
Code:
<html>
<head>
<script type="text/javascript" src="switchcontent.js" >

/***********************************************
* Switch Content script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated April 05th, 2007.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

<style type="text/css">

/*Style sheet used for demo. Remove if desired*/
.handcursor{
cursor:hand;
}

</style>
<style type="text/css">

/*Credits: Dynamic Drive CSS Library */
/*URL: http://www.dynamicdrive.com/style/ */

.glossymenu{
list-style-type: none;
margin: 5px 0;
padding: 0;
width: 500px;
border: 1px solid #9A9A9A;
}
.glossymenu li{
background-color: #EDEDED;
font: bold 13px "Lucida Grande", "Trebuchet MS", Verdana, Helvetica, sans-serif;
color: black;
text-indent: .5cm;
}
.glossymenu li a{
background: white url(media/glossyback.gif) repeat-x bottom left;
font: bold 13px "Lucida Grande", "Trebuchet MS", Verdana, Helvetica, sans-serif;
color: white;
display: block;
width: auto;
padding: 3px 0;
padding-left: 10px;
text-decoration: none;
text-indent: 0cm;
}


* html .glossymenu li a{ /*IE only. Actual menu width minus left padding of A element (10px) */
width: 500px;
}

.glossymenu li a:visited, .glossymenu li a:active{
color: white;
}

.glossymenu li a:hover{
background-image: url(media/glossyback2.gif);
}

</style>

</head>
<body>
<ul class="glossymenu">
<li><a href="#" id="comment1-title">Write Your Own Comment!</a></li>
<li id="comment1" class="switchgroup2">
<form action="Comments/Videos/1/submit.php" enctype="text/plain" method="post">
Display Name:
<br><input type="text" name="Dname" class="input">
<br>
<br><input type="hidden" name="time"/>
<br>
<br>
</p></li>
<?php include("comments.php"); ?>
</ul>
<script type="text/javascript">
var joeexample=new switchcontent("switchgroup2", "li")
joeexample.setStatus('', '')
joeexample.collapsePrevious(false) //Allow more than 1 content to be open simultanously
joeexample.setPersist(false)
joeexample.defaultExpanded(-1,-1)
joeexample.init()
</script>
</div>
</body>
</html>
File Name: Comments.php
Code:
<li><a href="#" id="comment2-title">Comment By: User</a></li>
<li id="comment2" class="switchgroup2">
I can't wait for the new uploads they sound awesome!!!
</p></li>
<li><a href="#" id="comment3-title">Comment By: User</a></li>
<li id="comment3" class="switchgroup2">
I can't wait for the new uploads they sound awesome!!!
</p></li>
File name: submit.php
Code:
<?php
$filename = "comment.php";
$input2 = $_POST["Name"];     
$input 
$n = '0';
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {

    // In our example we're opening $filename in append mode.
    // The file pointer is at the bottom of the file hence
    // that's where $somecontent will go when we fwrite() it.
    if (!$handle = fopen($filename, 'a')) {
         echo "Cannot open file ($filename)";
         exit;
    }

    // Write $somecontent to our opened file.
    if (fwrite($handle, $somecontent) === FALSE) {
        echo "Cannot write to file ($filename)";
        exit;
    }

    echo "Success, wrote your comment to file ($filename)";

    fclose($handle);

} else {
    echo "The file $filename is not writable";
}
?>
I need something that will check the first one of these:
Code:
comment3-title
in the code... and take the number (in this case 3) and will check to see if n's value is lower or higher than 3... if its lower than the n will be added like this
Code:
3+1=n *or plus 1 of the number of the comment#*
Thanks, if you got any questions ask and I'll answer...

Oh and how do you make it so that the data is written at the top of the file? I think its append... but at the same time I don't think so...
thanks!