<?php
$username="xxxxx";
$password="xxxxxx";
$database="address";
mysql_connect("xxxxxxxx",$username,$password);
mysql_select_db($database) or die( "Unable to select database");
$formaddress=$_POST['address'];
$selectQuery = db_query("SELECT address FROM addresses WHERE address='$formaddress'");
// see if there are any matches
if (db_numrows($selectQuery) == 1) {
// if a match occurs - update the addresslog table and send user to a specific page
db_query("INSERT INTO addresslog VALUES ('$formaddress')");
header("Location: http://www.thispage.com/");
} /// if no match, update addresslog table and send user to a different page
else {
db_query("INSERT INTO addresslog VALUES ('$formaddress')");
header("Location: http://www.otherpage.com/");
?>