hi,
this is my first post.
I am a php coder and know very little javascript. I have nearly finished a dating site for a client. Thing is he wants private chat in it. I have found some opensource chatroom code that I am trying to hack to make work privately.
I have nearly cracked it but I am struggling to get php to run within javascript.
I have an confirm popup when someone request a chat with a user and depending on whether the user clicks yes or no then the mysql_query enters either yes or no into the request field.
but I find that on page load both mysql queries run before the popu p confirm box has even had a chance to load.
I know that this is not written in ajax at the moment, but I think thats why it isnt working...because it should be.
My problem is that i have no knowledge of ajax at the mo and the site needs to be signed off asap, so don't have the time to learn ajax to sort it out myself.
any help would be hugely appreciated
heres the code
var answer = confirm ("wants to chat privatley with you")
if (answer)
{
popitup_chat('<? echo $url; ?>');
<?
mysql_query("INSERT INTO chat_pms(target,name,time,timestamp,request)VALUES('$from','$c_id','$time_stamp','$time_stamp','yes')");
?>
}
else
{
<?
mysql_query("INSERT INTO chat_pms(target,name,time,timestamp,request)VALUES('$from','$c_id','$time_stamp','$time_stamp','no')");
?>
}