thanks for ur reply and advice graphix. i think i can discuss with my supervisor. Thanks for ur help graphix, vault and raja. will be back for more questions : )
thanks for ur reply and advice graphix. i think i can discuss with my supervisor. Thanks for ur help graphix, vault and raja. will be back for more questions : )
thanks for ur reply graphix. do i need to create another file call message_send.php? i am starting to get this AJAX idea.... izzit separating the function into a php file and use the AJAX to call it back and execute?
thanks for ur reply graphix. izzit a preset function? (getMessage() , sendMessage(txt)) if it is where can i learn more about it? sorry about it... i am just a beginner in programming
thanks vault. i got some questions for you. a little background: my lan messenger looks like facebook messenger, when u click a small tab. it pops up a division; into the division there is a textarea2(displaying message in textarea1) and textarea1(message).
1. i tried using submit, however after i click submit, the division disappear. therefore i change to a 'button'. so shld i stay on my 'button' / 'submit'?
2. .$user. << why does the php var has 2 dots. what does it means?
3. should i redo my javascript function into PHP function?
Thanks raja and vault for ur kind reply : ) i can feel some warm from this forum : )
Example user enters "Hello! how are u guys doing. : Wed Jun 30 2010 17:18:23 GMT+0800" into the textarea1.. it will appear in textarea2. The text that the user entered, must be save into a database. but i encounter some problem when i am thinking about it. my table 'chat' has 4 table / attributes(Name,Content,Date,Time), how am i going to split a full text string, "You entered: Hello! how are u guys doing. : Wed Jun 30 2010 17:18:23 GMT+0800" into 4 different short string like "You entered: " , "Hello! how are u guys doing." , "Wed Jun 30 2010" , "17:18:23 GMT+0800" and store inside my tables?
thanks raja for ur reply. so i should create a new file call update.php??? what shld i put inside?
i am doing a LAN MESSENGER which look like a facebook taskbar. GUI done... send button done... now it's how to throw the result tat is generated by javascript and store it inside MYSQL database using PHP.... any1 can guide me?
hi everybody,
i encounter a problem regarding PHP when i am doing my internship.
i have a javascript which looks like this.
<Script Language = "JavaScript">
function sent()
{
var text1, fTxt,dT;
text1 = document.form1.EPTextField.value;
dT = new Date();
fTxt =("You entered" + ": " + text1 + " " + ":" + dT);
document.form1.EPText.value = fTxt;
}
</script>
where it will be called by onClick of a button
<input type="button" name="EPButton" id="EPButton" value="Send" onClick = "sent()"/>
However i need to save the fTxt into a database MySQL. my in charge called me to use php.
$con = mysql_connect("localhost","host"); //connect database
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("chat",$con); //select database
mysql_query("INSERT INTO chat (Name, Date, Content, Time)
VALUES ('fTxt')"); //insert
mysql_close($con);
?>
BUT here is the problem, my supervisor says that php doesn't understand what is the javascript value. so i need a platform like AJAX; i saw the ajax tutorial, i totally can't get it into my mind. so is there another way i can get it to work? or perhaps i can change the javascript function into a php function. but i tried googling "how to declare a var as a textbox value in php" and didnt get what VAULT said. I hope i can get some help here.