Ok so here is the situation, I have a javascript popup that will allow you to send a message to another user. I'm not using a form because I want the users to be able to send messages while staying on their current page. So what I'm doing is echo'ing out the php variable to the call function and then it gets sent off when the user hits the send button (id=mbutton)
When i go over to the javascript function and alert out the passed variable, it alerts fine right off the bat but goes to "undefined" after passed through an if statement.
As you can see from the code below, I have 2 alerts setup...as I said, the first alerts fine but the second one does not. Could anyone explain to me why this is happening?
<div id="msgcont">
<div id="msgheader">
<span>Send a Message to <? if($array['login']!=$c_log['login']) { echo
$array['login']; } ?> - Remember to be curtious! </span>
</div>
<div id="msgclose" onMouseDown="butclick('message', 'submit')"><span>X</span></div>
<textarea id="msg"></textarea>
<div id="mbutton" onMouseUP="butclick('send', 'submit', '<?
if($array['login']!=$c_log) { echo $array['login']; } ?>')"
onMouseDown="butclick('send', 'down')">Send</div>
</div>
function butclick(but, action, sentFrom) {
alert(sentFrom);
if(but=='send') {
alert(sentFrom);
x = document.getElementById('msg').value;
if(x==null || x=="") { alert("Please Enter your message before attemping to
send"); } else { }
}
}