mortalc Posted June 24, 2010 Author Share Posted June 24, 2010 Thanks, you're being a great help.Ok, what is the code for "scroll to the bottom of the page"? Scrollto() just has an X and Y coordinate, no way to always scroll to the bottom. You don't actually need to put the fopen/fwrite stuff in a function, thoughBut I can if I want, surely? Just to amke it sort of... neater.or above it, whichever you prefer as long as it appears after you've written to the fileThis is what confused me.ED:so... about the textarea... Link to comment Share on other sites More sharing options...
ShadowMage Posted June 24, 2010 Share Posted June 24, 2010 Thanks, you're being a great help.Ok, what is the code for "scroll to the bottom of the page"? Scrollto() just has an X and Y coordinate, no way to always scroll to the bottom.I'm not really sure to be honest. You could maybe get the coords of your input box and scroll to that position.But I can if I want, surely? Just to amke it sort of... neater.You could, yes. It's really kind of pointless though, and personally I think it would actually make is sloppier because you also have to call the function in order for it to execute. If you were to reuse it multiple times in the script then, sure, put it in a function but since it will only be used once it doesn't need to be. or above it, whichever you prefer as long as it appears after you've written to the fileThis is what confused me.By 'it' I meant the form. Echo out the contents of the file either before or after the form, but you need to get the contents after you've written to the file otherwise the new reply won't show up.so... about the textarea...Just put a textarea instead of an input:<textarea name='replyTxt' rows='4' cols='50'></textarea> Link to comment Share on other sites More sharing options...
mortalc Posted June 25, 2010 Author Share Posted June 25, 2010 <?phpfunction Reply(){$file = fopen ("Position.text","a");fwrite ($file, "<h3>".<$_POST["name"]."</h3>"."<small>".Date("d.M.Y", "H:i:s")."</small>."<br />".$_POST["reply"]);fclose ($file);echo file_get_contents("Position.text"); //Is this what you meant? I swapped it to after the fwrite().}?><form method="post" action=''><textarea name='replyTxt' rows='4' cols='50'></textarea> <input type="submit" value="reply"/> //How will this call the "Reply" function? Or should I make them seperate functions, and loop it all through constantly?</form> Link to comment Share on other sites More sharing options...
mortalc Posted June 26, 2010 Author Share Posted June 26, 2010 Ok.I have a few final questions.For this line: fwrite ($file, "<h3>".<$_POST["name"]."</h3>"."<small>".Date("d.M.Y", "H:i:s")."</small>."<br />".$_POST["reply"]); Will it format the code like I want? I'll most likely be popsting it to a HTML file instead of a text file (as there will be CSS style sheets).Also, won't it write the whole document again every time it is replied? until it is refreshed, of course. Link to comment Share on other sites More sharing options...
mortalc Posted June 28, 2010 Author Share Posted June 28, 2010 Will action='' make it refresh the page? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.