Hi guys,
I have a html form that php echo's out, and im now trying to add a character counter to the textfield, it works fine when its not wrapped in the php tags but i need the php to check if the user is logged in. Heres the code
if (isset($_SESSION['user'])){
echo('<form name ="post" action="*filename*" method="POST">
Subject: <input type="text" name="subject"><br>
post:<br><textarea cols="30" rows="5" name="message" onKeyDown="Counter(document.newbulletin.message,document.newbulletin.remLen1,125)" onKeyUp="Counter(document.newbulletin.message,document.newbulletin.remLen1,125)"></textarea><br>
<input readonly type="text" name="remLen1" size="3" maxlength="3" value="125">characters left<br>
<input type="submit" value="Post Thread" name="submit">
</form>
');
}
and the javascript is just
<SCRIPT LANGUAGE="JavaScript">
function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}
// End -->
</script>
It just doesnt like calling that function when its in the php echo.
Is this possible?
Thanks
p.s. not sure if this is the right place for this question, sorry if its not.