Issues with button data and "Column ____ cannot be null" ?

Hello… I keep getting the error “Column ‘Attendance’ cannot be null” when I submit this form. I’m guessing something is wrong with how I organize my button group for “yes/no” and/or the PHP data handoff. I’ve been trying different combinations but haven’t gotten it to work… please help!!

[php]<?php require_once('Connections/WeddingDB.php'); ?>

<?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "RSVPform")) { $insertSQL = sprintf("INSERT INTO Main_User_Database (createEmail, createPassword, createName, Attendance, GuestNumber, ArrivalDate, DepartureDate, Comments, WineTour, BarcelonaTour, Pamplona, Flamenco, Hiking, Costabrava) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['createEmail'], "text"), GetSQLValueString($_POST['createPassword'], "text"), GetSQLValueString($_POST['createName'], "text"), GetSQLValueString($_POST['Attendance'], "int"), GetSQLValueString($_POST['GuestNumber'], "int"), GetSQLValueString($_POST['ArrivalDate'], "text"), GetSQLValueString($_POST['DepartureDate'], "text"), GetSQLValueString($_POST['Comments'], "text"), GetSQLValueString($_POST['WineTour'], "int"), GetSQLValueString($_POST['BarcelonaTour'], "int"), GetSQLValueString($_POST['Pamplona'], "int"), GetSQLValueString($_POST['Flamenco'], "int"), GetSQLValueString($_POST['Hiking'], "int"), GetSQLValueString($_POST['Costabrava'], "int")); mysql_select_db($database_WeddingDB, $WeddingDB); $Result1 = mysql_query($insertSQL, $WeddingDB) or die(mysql_error()); } ?>[/php]

[code]

Jennifer and Michael's Wedding in Spain
    <link rel="stylesheet" href="css/bootstrap.css">
    <style> 
        body { padding-top: 105px; }
    </style>
    <link rel="stylesheet" href="css/bootstrap-responsive.css">
    <link rel="stylesheet" href="css/font-awesome.css">
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet"  title="red" href="css/red.css">
    <!--[if lt IE 9]>
        <script src="js/html5-3.6-respond-1.1.0.min.js"></script>
    <![endif]-->
<link rel="shortcut icon" href="http://www.jenmike.com/favicon.ico">
</head>
<body>
    
    <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="navbar-inner">
            <div class="container">
                <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                    <i class="icon icon-reorder"></i> Menu
                </a>
                <div class="nav-collapse collapse">
                    <ul class="nav">
                        <li><a href="index.html">Home</a></li>
                        <li><a href="story.html">Our Story</a></li>
                        <li><a href="venue.html">Venue</a></li>
                        <li><a href="activities.html">Activities</a></li>
                        <li><a href="blog.html">Blog</a></li>
                        <li><a href="registry.html">Registry</a></li>
                        <li class="active"><a href="login.php">RSVP</a></li>
					</ul>
                </div><!--/.nav-collapse -->
            </div>
        </div>
		<div class="sub-navbar">
			<div class="container">
			  <p style="color:black;"><i class="icon icon-user"></i> Hello, Guest. <a class="btn btn-login" href="rsvp.php">Login here &raquo;</a></p>
			</div>
		</div>
    </div>
    
    <div class="main">
    	<div class="container">
    		
			<h2><span>RSVP Form</span></h2>
            <div>
            <p>

Please enter you RSVP information below.

First: Provide your email address and the password you would like to use on this site. This will enable you to view wedding photos, videos, and other content after the wedding.

Second: Enter your name, whether you can attend, how many guests you expect to bring, and you're rough arrival and departure dates. This will help us schedule transportation and activities for you and your guests.

Third: Enter which activities you would be interested in. We will use this data to organize trips for the group during your time in Barcelona.

Finally: Click submit! This data will be saved in our database. If you would like to change any of the choices you made, you can revisit the site, re-enter your email and password, and make changes to this form. After submitting, check your email for a confirmation message including a reminder with your username and password.


          <div class="row">
    			<div class="span6">
                    <strong>Basic Information:</strong>
                    <br/>
                    <br/>
          <form action="<?php echo $editFormAction; ?>" method="POST" name="RSVPform" class="form-horizontal">
                        <div class="control-group">
                            <label class="control-label" for="createEmail">Email address</label>
                            <div class="controls">
                                <input class="input-xlarge" type="text" name="createEmail" id="createEmail" placeholder="[email protected]">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="createPassword">Create a password</label>
                            <div class="controls">
                                <input class="input-xlarge" type="password" name="createPassword" id="createPassword" placeholder="Password">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="confirmPassword">Confirm password</label>
                            <div class="controls">
                                <input class="input-xlarge" type="password" name="confirmPassword" id="confirmPassword" placeholder="Password">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="createName">Your name</label>
                            <div class="controls">
                                <input class="input-xlarge" type="text" name="createName" id="createName" placeholder="John Appleseed">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="createAttendance">Will You Attend?</label>
                            <div class="controls">
                                <input class="btn-group" type="hidden" name="createAttendance" value="" id="createAttendance">
                                <div class="btn-group btn-group-vertical" data-toggle="buttons-radio">
                                <button type="button" data-toggle="button" name="option" value="1" class="btn btn-secondary">Accept with pleasure</button>
                                <button type="button" data-toggle="button" name="option" value="0" class="btn btn-secondary">Decline with regret </button>
                                </div>
                            </div>
                        </div>
                            
                      <div class="control-group">
                            <label class="control-label" for="GuestNumber">Guests with you?</label>
                           <div class="controls">
                                <input class="input-xlarge" type="text" name="GuestNumber" id="GuestNumber" placeholder="0, 1, 2, 3...">
                           </div>
                      </div> 
                       <div class="control-group">
                            <label class="control-label" for="ArrivalDate">When do you plan to arrive in Barcelona?</label>
                           <div class="controls">
                                <input class="input-xlarge" type="text" name="ArrivalDate" id="ArrivalDate" placeholder="MM/DD">
                           </div>
                      </div>
                      <div class="control-group">
                            <label class="control-label" for="DepartureDate">When do you plan to depart Barcelona?</label>
                           <div class="controls">
                                <input class="input-xlarge" type="text" id="DepartureDate" placeholder="MM/DD">
                           </div>
                      </div>
                      <div class="control-group">
                            <label class="control-label" for="Comments">Any additional comments?</label>
                           <div class="controls">
                             <input class="input-xlarge" type="text" name="Comments" id="Comments" placeholder="Meal considerations, questions...">
                           </div>
                      </div>
                 </div>
                      <!--/span6-->
               
        		<div class="span6">
                    <strong>Are you interested in...:</strong>
                    <br/>
                    <br/>  
                        <div class="control-group">
                            <label class="control-label" for="WineTour">Going on a wine tour?</label>
                            <div class="controls">
                                <input class="btn-group" type="hidden" name="WineTour" value="" id="WineTour">
                                <div class="btn-group" data-toggle="buttons-radio">
                                <button id="btn-one" type="button" data-toggle="button" name="option" value="1" class="btn btn-secondary">Yes</button>
                                <button id="btn-two" type="button" data-toggle="button" name="option" value="2" class="btn btn-secondary">No </button>
                                </div>
                            </div>
                        </div>
                            
                        <div class="control-group">
                            <label class="control-label" for="BarcelonaTour">Group tour of Barcelona?</label>
                            <div class="controls">
                                <input class="btn-group" type="hidden" name="BarcelonaTour" value="" id="BarcelonaTour">
                                <div class="btn-group" data-toggle="buttons-radio">
                                <button id="btn-one" type="button" data-toggle="button" name="option" value="1" class="btn btn-secondary">Yes</button>
                                <button id="btn-two" type="button" data-toggle="button" name="option" value="2" class="btn btn-secondary">No </button>
                                </div>
                            </div>
                        </div>
                            
                        <div class="control-group">
                            <label class="control-label" for="Pamplona">Day trip to Pamplona for Bull Run?</label>
                            <div class="controls">
                                <input class="btn-group" type="hidden" name="Pamplona" value="" id="Pamplona">
                                <div class="btn-group" data-toggle="buttons-radio">
                                <button id="btn-one" type="button" data-toggle="button" name="option" value="1" class="btn btn-secondary">Yes</button>
                                <button id="btn-two" type="button" data-toggle="button" name="option" value="2" class="btn btn-secondary">No </button>
                                </div>
                            </div>
                        </div>
                            
                        <div class="control-group">
                            <label class="control-label" for="Flamenco">Attending Flamenco dance show?</label>
                            <div class="controls">
                                <input class="btn-group" type="hidden" name="Flamenco" value="" id="Flamenco">
                                <div class="btn-group" data-toggle="buttons-radio">
                                <button id="btn-one" type="button" data-toggle="button" name="option" value="1" class="btn btn-secondary">   Yes  </button>
                                <button id="btn-two" type="button" data-toggle="button" name="option" value="2" class="btn btn-secondary">   No  </button>
                                </div>
                            </div>
                        </div>
                            
                        <div class="control-group">
                            <label class="control-label" for="Hiking">Going hiking and kayaking?</label>
                            <div class="controls">
                                <input class="btn-group" type="hidden" name="Hiking" value="" id="Hiking">
                                <div class="btn-group" data-toggle="buttons-radio">
                                <button id="btn-one" type="button" data-toggle="button" name="option" value="1" class="btn btn-secondary">   Yes  </button>
                                <button id="btn-two" type="button" data-toggle="button" name="option" value="2" class="btn btn-secondary">   No  </button>
                                </div>
                            </div>
                        </div>
                            
                        <div class="control-group">
                            <label class="control-label" for="Costabrava">Day trip to Costa Brava?</label>
                            <div class="controls">
                                <input class="btn-group" type="hidden" name="Costabrava" value="" id="Costabrava">
                                <div class="btn-group" data-toggle="buttons-radio">
                                <button id="btn-one" type="button" data-toggle="button" name="option" value="1" class="btn btn-secondary">   Yes  </button>
                                <button id="btn-two" type="button" data-toggle="button" name="option" value="2" class="btn btn-secondary">   No  </button>
                                </div>
                            </div>         
                        </div>            
                    </div>
                    <button type="submit" class="btn">Confirm RSVP</button>
                    <input type="hidden" name="MM_insert" value="RSVPform">
	  </div><!--/span6-->
</div><!--/row-->
            <hr> 
    	</div><!--/container-->
    </div><!--/main-->
    
    <footer>
    	<div class="container">
    		<div class="row">
    			<p>Designed by Mike and Jen - 2012</p>
    		</div>
    	</div>
    </footer>

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="js/jquery-1.8.0.min.js"><\/script>')</script>

    <script src="js/bootstrap.min.js"></script>

    <script src="js/script.js"></script>
</body>
[/code]
Sponsor our Newsletter | Privacy Policy | Terms of Service