mahipps Posted January 15, 2010 Share Posted January 15, 2010 Below is my code. I'm trying to drop some simple data into a table. Nothing is updating. Any suggestions? Thanks! <?php include('config.php'); $regis=$_POST['register']; if ($regis=="") { $nothing=0; $FirstName=$_GET['FirstName']; $LastName=$_GET['LastName']; $Address=$_GET['Address']; $Address2=$_GET['Address2']; $City=$_GET['City']; $State=$_GET['State']; $ZipCode=$_GET['ZipCode']; $Phone=$_GET['Phone']; $Email=$_GET['Email']; $Emergencycontact=$_GET['Emergencycontact']; $Emergencyphone=$_GET['Emergencyphone']; $Medshealth=$_GET['Medshealth']; $Referred=$_GET['Referred']; $Affilstudio=$_GET['Affilstudio']; $Repeat=$_GET['Repeat']; $msg=$_GET['msg']; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" media="all" href="960css/reset.css" /> <link rel="stylesheet" type="text/css" media="all" href="960css/960.css" /> <link rel="stylesheet" type="text/css" media="all" href="960css/text.css" /> <link rel="stylesheet" type="text/css" media="all" href="960css/mystyle.css" /> <title></title> <script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script> <link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" /> </head><body> <form method="post" action="register.php"><br><?php echo($msg); ?><br> <table width="720" border="0" cellspacing="2" cellpadding="0"> <tr> <td><span class="formapp">First Name:</span></td> <td><span id="sprytextfield1"> <input name="FirstName" type="text" value="<?php echo($FirstName); ?>" size="25" maxlength="25" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></td> </tr> <tr> <td><span class="formapp">Last Name:</span></td> <td><span id="sprytextfield2"> <input name="LastName" type="text" value="<?php echo($LastName); ?>" size="25" maxlength="25" /> <span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></td> </tr> <tr> <td><span class="formapp">Address:</span></td> <td><span id="sprytextfield3"> <input name="Address" type="text" value="<?php echo($Address); ?>" size="60" maxlength="60" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></td> </tr> <tr> <td><span class="formapp">Address2:</span></td> <td> <span class="formapp"> <input name="Address2" type="text" value="<?php echo($Address2); ?>" size="60" maxlength="60" /> </span></td> </tr> <tr> <td><span class="formapp">City:</span></td> <td><span id="sprytextfield4"> <input name="City" type="text" value="<?php echo($City); ?>" size="15" maxlength="15" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></td> </tr> <tr> <td><span class="formapp">State:</span></td> <td><span id="sprytextfield5"> <input name="State" type="text" value="<?php echo($State); ?>" size="2" maxlength="2" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></td> </tr> <tr> <td><span class="formapp">ZipCode:</span></td> <td><span id="sprytextfield6"> <input name="ZipCode" type="text" value="<?php echo($ZipCode); ?>" size="5" maxlength="5" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></td> </tr> <tr> <td><span class="formapp">Phone:</span></td> <td><span id="sprytextfield7"> <input name="Phone" type="text" value="<?php echo($Phone); ?>" size="12" maxlength="12" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></td> </tr> <tr> <td><span class="formapp">E-mail:</span></td> <td><span id="sprytextfield8"> <input name="Email" type="text" value="<?php echo($Email); ?>" size="40" maxlength="40" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span></span></td> </tr> <tr> <td><span class="formapp">Emergency Contact:</span></td> <td><span id="sprytextfield9"> <input name="Emergencycontact" type="text" value="<?php echo($Emergencycontact); ?>" size="30" maxlength="30" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span><?php echo($_GET['msg']); ?></td> </tr> <tr> <td><span class="formapp">Emergency Phone: </span></td> <td><span id="sprytextfield10"> <input name="Emergencyphone" type="text" value="<?php echo($Emergencyphone); ?>" size="12" maxlength="12" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></td> </tr> <tr> <td><span class="formapp">Medications / Health Info:</span></td> <td><span id="sprytextfield11"> <input name="Medshealth" type="text" value="<?php echo($Medshealth); ?>" size="200" maxlength="200" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span><?php echo($_GET['msg']); ?></td> </tr> <tr> <td><span class="formapp">Referred By: </span></td> <td><span id="sprytextfield12"> <input name="Referred" type="text" value="<?php echo($Referred); ?>" size="30" maxlength="30" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></td> </tr> <tr> <td><span class="formapp">Affiliate Studio: </span></td> <td><span id="sprytextfield13"> <input name="Affilstudio" type="text" value="<?php echo($Affilstudio); ?>" size="30" maxlength="30" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></td> </tr> <tr> <td><span class="formapp">Previous Programs: </span></td> <td><span id="sprytextfield14"> <input name="Repeat" type="text" value="<?php echo($Repeat); ?>" size="60" maxlength="60" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></td> </tr> <tr> <td> </td> <td> <span class="formapp"> <input type="submit" value="Register Now" name="register" /> </span></td> </tr> </table><br> </form> <script type="text/javascript"> <!-- var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {minChars:1, maxChars:25}); var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {minChars:2, maxChars:25}); var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {minChars:5, maxChars:25}); var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "none", {minChars:3, maxChars:25}); var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "none", {minChars:2, maxChars:2}); var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "none", {minChars:4, maxChars:7}); var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7", "none", {minChars:5, maxChars:12}); var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8", "email", {minChars:5, maxChars:30}); var sprytextfield9 = new Spry.Widget.ValidationTextField("sprytextfield9", "none", {minChars:5, maxChars:30}); var sprytextfield10 = new Spry.Widget.ValidationTextField("sprytextfield10", "none", {maxChars:14, minChars:6}); var sprytextfield11 = new Spry.Widget.ValidationTextField("sprytextfield11", "none", {maxChars:50, minChars:0}); var sprytextfield12 = new Spry.Widget.ValidationTextField("sprytextfield12", "none", {maxChars:30, minChars:0}); var sprytextfield13 = new Spry.Widget.ValidationTextField("sprytextfield13", "none", {maxChars:30, minChars:0}); var sprytextfield14 = new Spry.Widget.ValidationTextField("sprytextfield14", "none", {maxChars:60, minChars:0}); //--> </script> </body> <?php } else { $sql="SELECT * FROM fiaaustin where Email like '".$_POST['Email']."'"; $result=mysql_query($sql); $numRows = mysql_num_rows($result); $FirstName=$_POST['FirstName']; $LastName=$_POST['LastName']; $Address=$_POST['Address']; $Address2=$_POST['Address2']; $City=$_POST['City']; $State=$_POST['State']; $ZipCode=$_POST['ZipCode']; $Phone=$_POST['Phone']; $Email=$_POST['Email']; $Emergencycontact=$_POST['Emergencycontact']; $Emergencyphone=$_POST['Emergencyphone']; $Medshealth=$_POST['Medshealth']; $Referred=$_POST['Referred']; $Affilstudio=$_POST['Affilstudio']; $Repeat=$_POST['Repeat']; if ($numRows!=0){ $msg="The username is taken. Please choose another."; $urlred="Location: register.php?Username=".$Username."&Password=".$Password."&FirstName=".$FirstName."&LastName=".$LastName."&Address=".$Password."&Address="; $urlred=$urlred.$Address."&Address2=".$Address2."&City=".$City."&State=".$State."&Phone="; $urlred=$urlred.$Phone."&Email=".$Email."&msg=".$msg."&ZipCode=".$ZipCode; header($urlred); } else { $sqlinsert="INSERT INTO fiaaustin VALUES ("; $sqlinsert=$sqlinsert."NULL, '".$FirstName."', '".$LastName."', '".$Address."', '".$Address2."', '".$City."', '".$State."', '".$ZipCode."', '".$Phone."', '".$Email."','".$Emergencycontact."', '".$Emergencyphone."', '".$Medshealth."', '".$Referred."', '".$Affilstudio."', '".$Repeat."', ''"; $sqlinsert=$sqlinsert.")"; mysql_query($sqlinsert); ?> <br> Thank you for registering. <?php } } ?> Link to comment https://forums.phpfreaks.com/topic/188596-database-table-not-updating-any-suggestions/ Share on other sites More sharing options...
Buddski Posted January 15, 2010 Share Posted January 15, 2010 error_reporting(E_ALL); ini_set('display_errors',1); at the top of your page and add or trigger_error(mysql_error()); to your mysql function calls mysql_query(....) or trigger_error(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/188596-database-table-not-updating-any-suggestions/#findComment-995702 Share on other sites More sharing options...
mahipps Posted January 15, 2010 Author Share Posted January 15, 2010 Ok, I did that and I'm getting several "Undefined Index" errors. Would this keep the data table from updating? I'm very new to PHP so sorry if this is a stupid question. Thanks! Link to comment https://forums.phpfreaks.com/topic/188596-database-table-not-updating-any-suggestions/#findComment-995716 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.