Current location: Hot Scripts Forums » Programming Languages » PHP » to get javascript in php script


to get javascript in php script

Reply
  #1 (permalink)  
Old 06-03-05, 07:10 AM
upendrakumar upendrakumar is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
to get javascript in php script

hi,

i have generated a date in javascript and need to send it in php script to get saved in database.
How to do this??????????????????????


Give assistance

upendra
Reply With Quote
  #2 (permalink)  
Old 06-03-05, 08:47 AM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
maybe u can do:

Code:
<script language="javascript">
var date = JAVASCRIPT DATE CODE HERE
var url = "logdate.php?date="+date;
open(url,'newwin','toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=1,height=1');
</script>
(you need to delete the spaces in the open code, its a wordwrap thing on the forum)
Then in logdate.php you put:

PHP Code:

<?php


//get the date from the ?date= string
$date $_GET['date'];

//connect to database here

//insert date
mysql_query("INSERT INTO tablename (date) VALUES('$date')");

//close database
mysql_close();

?>
<html>
<body onload="javascript:window.close();">
</body>
</html>
obviously you have to change parts of it! it would be a lot easier to just use the date() function...
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.

Last edited by FiRe; 06-03-05 at 08:49 AM.
Reply With Quote
  #3 (permalink)  
Old 06-03-05, 09:55 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
this is way of doing it, or you can use XMLHttpRequest to send the data in the background without the need for a popup window.
here is a tutorial I wrote not long ago about it:
http://www.phpsimplicity.com/tips.php?id=16
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
custom php script needed alley Job Offers & Assistance 5 06-30-10 02:14 AM
2 profitable script sites for sale cms-master.com General Advertisements 3 07-03-07 10:17 AM
PHP script problem (please help) osmanmumtaz PHP 0 05-24-05 07:29 AM
trying to create my first simple (?) php script, need guidance HotShotPhoto PHP 1 09-06-04 08:12 PM
Affiliate script (PHP) whtiebear Job Offers & Assistance 2 12-21-03 12:12 AM


All times are GMT -5. The time now is 06:49 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.