I'm creating a website with the option to Login with an administrative account and I want to be able to edit different elements in the HTML set to javascript variables. When you log in, there will be an input box to take a value from the user and apply it to a widget on the page. I haven't yet found a way to save the input value by overwriting the variable set for the widget and have it save to the webhost (GoDaddy) and stay throughout all sessions for anyone who shall be looking. I don't want to use Cookies or localStorage because I would like for the value to not only save on that user's session but all looking at the site. Ideas?
(EDITED CONTENT BELOW) Alright, I've used a database. I've gotten the code below:
<html>
<head>
<title>
MyAccount
</title>
</head>
<body>
<center>
<h1>
Welcome to your account!
</h1>
<input name="alertVal" type="text" placeholder="Alert Value">
<input type="button" text="Save" onclick="<?php saveAlert()?>">
<?php
// Connects to your Database
function saveAlert(){
mysql_connect("My IP is here. Not sharing that.", "adminLog", "Yeah, not putting my pass on a forum...") or die(mysql_error());
mysql_select_db("adminLog") or die(mysql_error());
$data = mysql_query("SELECT * FROM Alert")
or die(mysql_error());
while($info == mysql_fetch_array( $data ))
{
mysql_query("Update Alert SET Value = '$cleanURL'")
INSERT INTO Alert (Value);
VALUES ($_GET['alertVal']);
}
}
?>
</center>
</body>
</html>
And that doesn't work. Raises a T_STRING error. I don't really understand that. Help?