javascript, php, cookies
<p>the application returns a value "1" in the database instead of the mac address... </p>

<p>I'm able to document.write the output of the mac address, but not able to have it store in the database.</p>

<p>Is the program using the previous cookie? (but Ive deleted all the cookies from the pc)</p>

<p>but if i change the variable mac to string data, it keep refresh my webpage. Why is that so... (var mac="test data";)</p>

<p>Please help!</p>

<p>create_users.php</p>

<pre><code>&lt;script language="JavaScript"&gt;

function getMacAddress(){
document.macaddressapplet.setSep( "-" );
return (document.macaddressapplet.getMacAddress());
}

function setCookie(c_name,value) {
document.cookie = c_name + "=" +escape(value);
}

//var mac="test data";
var mac = getMacAddress();


setCookie('cookie_name',mac);
window.location = "checkAvailability.php";

&lt;/script&gt; 

&lt;script type="text/javascript"&gt;
document.write(getMacAddress());
&lt;/script&gt;
</code></pre>

<p>checkAvailiability.php</p>

<pre><code>$dbhost = 'localhost';
$dbuser = 'root';
$dbname = 'registration';
mysql_connect($dbhost, $dbuser) or die("Could not connect database");
mysql_select_db($dbname);
$javascript_cookie_value = isset($_COOKIE["cookie_name"]) ? $_COOKIE["cookie_name"] : 1;
mysql_query("INSERT INTO test (mac) VALUES ('$javascript_cookie_value')");
</code></pre>
