On Wed, Apr 8, 2009 at 12:50 PM, Michael A. Peters <mpeters@xxxxxxx> wrote: > Terion Miller wrote: > >> >> >> javascript is client side. >> php is server side. >> To use something client side in a server side script, the web page >> has to send it to the server from the client. >> >> The best way to do what you want to do is probably to do the work >> count server side, but if you really want to use what javascript >> produced you can create a hidden input with a specified id, and use >> dhtml via javascript to modify the input and insert the value into >> the value field of the hidden input. Then it will get sent to the >> server when the user hits the post button. >> >> However, since you should be validating any user input server side, >> you'll need to validate that the variable is accurate - might as >> well just do the count with php server side. >> >> >> >> Thanks Michael I was kind of moving in the right direction as far as the >> hidden input goes, going to have to google on how to do it with the dhtml >> and all like you suggested. >> > > Look at the various DOM functions - IE for > > <input type="hidden" name="wordcount" id="hiddenStudd" value=""> > > you coud do in your js: > > var myHidden = document.getElementById('hiddenStuff'); > myHidden.setAttribute('value',$yourvalue); > Thought I would go ahead and post a bit more on this, so here is my wordcount little function on the textarea of the form: <textarea name="Comments" cols="55" rows="5" wrap="hard" onKeyDown="wordCounter(this.form.Comments,this.form.remLen, 300);" onKeyUp="wordCounter(this.form.Comments,this.form.remLen, 300);"><?php if (isset($_SESSION['Comments'])) {echo $_SESSION['Comments'];} ?></textarea><br>Letters to the Editor are limited to 300 words or less.<br>Words remaining: <input type=box readonly name=remLen size=3 value=300> So I was thinking I should be able to pass that again to the next page which is the emailform.php page that is taking all the id= and printing them to an email .... should be able to reuse that function right? <input type="hidden" id="words" value="" onSubmit="return wordCounter(this.form.Comments,this.form.remLen);" > or do I need to define the variable? think I'm starting to confuse myself lol