Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

n00b - passing variables! from HTML to PHP?

Codes here !

Moderators: macek, egami, gesf

n00b - passing variables! from HTML to PHP?

Postby php-punk » Sun Feb 02, 2003 5:27 am

right i made a stats page, but is tehre anyway i can use java script to active the PHP page to record the stats?! this is my script for the php page:

Code: Select all
<?
//getting the user's IP address
$Rip=$_SERVER['REMOTE_ADDR'];
//getting the user's Port
$Rport=$_SERVER['REMOTE_PORT'];


//Getting the user's Browser (Agent)
$b=$_SERVER['HTTP_USER_AGENT'];

//getting the referries URL
$r=$_SERVER['HTTP_REFERER'];

//Put all this into a Database for later viewing:


//connect to the DB
$Connect=mysql_connect(localhost,stu3sk8r,badger);

//select DB
$DB=mysql_select_db(stu3sk8r_uk_db);

//setting the query in a variable, the query, in this case it INSERTS to the db
$query="INSERT INTO cstats (`ip`,`port`,`browser`,`reffer`,`date`) VALUES ('$Rip','$Rport','$b','$r','');";

//running the actual query
mysql_query($query);

?>


al i know it that it would need ot be done over a command line, but not a clue how?!

any help greatly appriciated
php-punk
New php-forum User
New php-forum User
 
Posts: 60
Joined: Sun Feb 02, 2003 2:10 am
Location: Leeds, Uk

Postby Joan Garnet » Sun Feb 02, 2003 12:29 pm

I would reload the page with a javascript setTimeOut() calling to a fuction that would reload the page sending some GET variables that then would update the database.
User avatar
Joan Garnet
Moderator
Moderator
 
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars


Return to mySQL & php coding

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.