PDA

View Full Version : How do I modify this script to contain.....



Ecopetition
31 Aug 2006, 06:00 PM
Hi guys.

How can I modify the following code:


<?php
$host="localhost"; // Host name
$username="ecopeter_peter"; // Mysql username
$password="peters65415"; // Mysql password
$db_name="ecopeter_petition"; // Database name
$tbl_name="admin_petition"; // DO NOT CHANGE

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect server ");
mysql_select_db("$db_name")or die("cannot select DB");

$datetime=date("y-m-d h:i:s"); //date time

$sql="INSERT INTO $tbl_name(name, email, postcodezip, country, newsletter)VALUES('$name', '$email',

'$postcodezip', '$country', '$newsletter')";
$result=mysql_query($sql);

//check if query successful
if($result){
echo "";
echo "Please wait while our server redirects you to the confirmation page...";
echo "<BR>";
echo "<a href='#'>Back to site.</a>"; // link to view guestbook page
}

else {
echo "ERROR. Please contact the administrator.";
}

mysql_close();
?>

to contain the variable $_SERVER['REMOTE_ADDR'], which tracks the IP address. Can someone please modify the code as it should be? I'm not too good with this...

Thanks again,
Peter