I was thinking in doing a Chat Box in PHP. For that I would use a form with two fields, Nick and Message, then I would store the data in a DB and show them. I have already made the code for this. In the Chat Boxes I saw there the tima/date always appears in front of the messages. I don't need the time but I'd want to send to a database field the date of the moment when the user clicks the subtim button for orientation purposes. Can someone give me an hint on how to do this? Thanks
You would need to use Javascript, specifically AJAX for the submitting and retrieving of the messages without page reloading. May i suggest Yahoo's YUI. It has many nice functions. Also jQuery can do the same. Logically here is how an AJAX Chatbox works User Enters Text In A Form And Press Enter Sends the Text To A PHP File VIA AJAX And Inserts It etc After Insertion, Echos That Message Plus The Last X ex (20) Then The AJAX Response Handler Captures The Echo Of The PHP Script And Sets The Message Box To It. ie div.innerHTML = ajax.responceText You might also have to implement an auto refresh for every X seconds.
You dont need time but you need date? lol What do you mean by that? the exact time Hours:Minutes:Seconds ?
I want to show the date on which the user clicked the submit button. The time isn't mandatory, the user can guide himself by the date not to post in a chat box that hasn't been used for a year lol. But if the time doesn't require extra work of course I want to show it too. I only want to do this if it doesn't involve AJAX or other programming languages I don't know. In this site for example: http://speakabout.6te.net/ The user submits a new topic and it appears in the frontpage with the date on which it was submitted. I don't need an auto-refresh function or something like that, it's a simple school project, I have less that two weeks to finish it lol. I've two form fields and a submit button. I want to store the date on whick the user has clicked the button. Is AJAX needed to do this? This won't work? http://dev.mysql.com/doc/refman/5.0/en/timestamp.html Thanks for your help
oh its easy, you need just this //month-date-year $date = date("m-d-Y"); PHP: if you also need time then $date_time = date("m-d-Y H:i:s"); PHP: And then just add date var to ur database