Jump to content

Can't update DB


xcandiottix

Recommended Posts

$con = mysql_connect("site.com","UN","PW");
mysql_select_db("DB", $con);
$userid=$_SESSION['user'];
=====
if($_COOKIE['save'] == "yes"){
$pc_bgc = $_POST['bgcolor'];
}
=====
mysql_query("UPDATE user_css SET
	       pc_background='$pc_bgc'
	       WHERE db_username='$userid'");
=====
if(isset($_POST['bgcolor'])){
echo'background:'.$_POST["bgcolor"].';';
$info['pc_background'] = $_POST['bgcolor'];
}
else{
echo'background:'.$info["pc_background"].';';
}
=====
<form name="settings" method="post">
Background: <input class="color" name="bgcolor" value="<?php echo $info['pc_background'];?>" size="5" maxlength="9" width="9">
</form>
=====
<SCRIPT LANGUAGE="JavaScript" TYPE="TEXT/JAVASCRIPT">
<!--
function savecookie()
   {
   document.cookie="save=yes";
   }
</SCRIPT>
=====
<input name="submit" type="submit" accesskey="s" tabindex="13" value="Save Changes" onClick='savecookie();settings.submit();' />

 

Okay, so here's my problem. I have a table that lets a user change form settings that reflect those changes as CSS.  My database has 1 field for each css option on the form. When I click save, nothing is passed to the database. However, if I change:

if($_COOKIE['save'] == "yes"){
$pc_bgc = Hello;
}

"Hello" will be passed to the DB. I don't understand why this won't work anymore. During testing with my initial 20 css options everything worked relatively fine. I finalized the form today and it has approximately 133 options which means 133 possible POST variables. Is it possible I am posting too much data at once?

Link to comment
https://forums.phpfreaks.com/topic/206929-cant-update-db/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.