xcandiottix Posted July 6, 2010 Share Posted July 6, 2010 $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 More sharing options...
msaz87 Posted July 6, 2010 Share Posted July 6, 2010 Just a shot in the dark here, but maybe it doesn't like $_POST. Try switching it to $_REQUEST and see if that makes a difference. Link to comment https://forums.phpfreaks.com/topic/206929-cant-update-db/#findComment-1082124 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.