cturner Posted January 28, 2007 Share Posted January 28, 2007 My code below is not updating for me. It just goes to the next page (clearing_sale_edited.php) without the id number in it, after I press the submit button. Can someone please have a look at my code and tell me why this is happening? Thanks in advance.Here is my whole code:[code=php:0]require "config.php";if (is_numeric($_GET['id'])) { $id = mysql_real_escape_string($_GET['id']);}$sql = mysql_query("SELECT * FROM `clearingsales` WHERE `id` = '$id'") or die ("Could not query because: ".mysql_error());$row = mysql_fetch_assoc($sql);echo $row['propertyname']; // displayed in the title tag$propertyname = "";if (isset($_POST['propertyname'])) { $propertyname = str_replace("\r\n","",$_POST['propertyname']); $propertyname = stripslashes($propertyname); $propertyname = mysql_real_escape_string($propertyname);}$selectDay = "";if (isset($_POST['selectDay'])) { $selectDay = mysql_real_escape_string($_POST['selectDay']);}$selectDate = "";if (isset($_POST['selectDate'])) { $selectDate = mysql_real_escape_string($_POST['selectDate']);}$selectMonth = "";if (isset($_POST['selectMonth'])) { $selectMonth = mysql_real_escape_string($_POST['selectMonth']);}$selectYear = "";if (isset($_POST['selectYear'])) { $selectYear = mysql_real_escape_string($_POST['selectYear']);}$time = "";if (isset($_POST['time'])) { $time = mysql_real_escape_string($_POST['time']);}$accountname = "";if (isset($_POST['accountname'])) { $accountname = mysql_real_escape_string($_POST['accountname']);}$comments = "";if (isset($_POST['comments'])) { $comments = str_replace("\r\n","",$_POST['comments']); $comments = stripslashes($comments);}$select1 = "";if (isset($_POST['select1'])) { $select1 = mysql_real_escape_string($_POST['select1']);}$txt1 = "";if (isset($_POST['txt1'])) { $txt1 = str_replace("\r\n","",$_POST['txt1']); $txt1 = stripslashes($txt1);}$select2 = "";if (isset($_POST['select2'])) { $select2 = mysql_real_escape_string($_POST['select2']);}$txt2 = "";if (isset($_POST['txt2'])) { $txt2 = str_replace("\r\n","",$_POST['txt2']); $txt2 = stripslashes($txt2);}$select3 = "";if (isset($_POST['select3'])) { $select3 = mysql_real_escape_string($_POST['select3']);}$txt3 = "";if (isset($_POST['txt3'])) { $txt3 = str_replace("\r\n","",$_POST['txt3']); $txt3 = stripslashes($txt3);}$select4 = "";if (isset($_POST['select4'])) { $select4 = mysql_real_escape_string($_POST['select4']);}$txt4 = "";if (isset($_POST['txt4'])) { $txt4 = str_replace("\r\n","",$_POST['txt4']); $txt4 = stripslashes($txt4);}$select5 = "";if (isset($_POST['select5'])) { $select5 = mysql_real_escape_string($_POST['select5']);}$txt5 = "";if (isset($_POST['txt5'])) { $txt5 = str_replace("\r\n","",$_POST['txt5']); $txt5 = stripslashes($txt5);}$select6 = "";if (isset($_POST['select6'])) { $select6 = mysql_real_escape_string($_POST['select6']);}$txt6 = "";if (isset($_POST['txt6'])) { $txt6 = str_replace("\r\n","",$_POST['txt6']); $txt6 = stripslashes($txt6);}$select7 = "";if (isset($_POST['select7'])) { $select7 = mysql_real_escape_string($_POST['select7']);}$txt7 = "";if (isset($_POST['txt7'])) { $txt7 = str_replace("\r\n","",$_POST['txt7']); $txt7 = stripslashes($txt7);}$select8 = "";if (isset($_POST['select8'])) { $select8 = mysql_real_escape_string($_POST['select8']);}$txt8 = "";if (isset($_POST['txt8'])) { $txt8 = str_replace("\r\n","",$_POST['txt8']); $txt8 = stripslashes($txt8);}$select9 = "";if (isset($_POST['select9'])) { $select9 = mysql_real_escape_string($_POST['select9']);}$txt9 = "";if (isset($_POST['txt9'])) { $txt9 = str_replace("\r\n","",$_POST['txt9']); $txt9 = stripslashes($txt9);}$select10 = "";if (isset($_POST['select10'])) { $select10 = mysql_real_escape_string($_POST['select10']);}$txt10 = "";if (isset($_POST['txt10'])) { $txt10 = str_replace("\r\n","",$_POST['txt10']); $txt10 = stripslashes($txt10);}$select11 = "";if (isset($_POST['select11'])) { $select11 = mysql_real_escape_string($_POST['select11']);}$txt11 = "";if (isset($_POST['txt11'])) { $txt11 = str_replace("\r\n","",$_POST['txt11']); $txt11 = stripslashes($txt11);}$other1 = "";if (isset($_POST['other1'])) { $other1 = mysql_real_escape_string($_POST['other1']);}$other2 = "";if (isset($_POST['other2'])) { $other2 = mysql_real_escape_string($_POST['other2']);}$other3 = "";if (isset($_POST['other3'])) { $other3 = mysql_real_escape_string($_POST['other3']);}$other4 = "";if (isset($_POST['other4'])) { $other4 = mysql_real_escape_string($_POST['other4']);}$other5 = "";if (isset($_POST['other5'])) { $other5 = mysql_real_escape_string($_POST['other5']);}$other6 = "";if (isset($_POST['other6'])) { $other6 = mysql_real_escape_string($_POST['other6']);}$other7 = "";if (isset($_POST['other7'])) { $other7 = mysql_real_escape_string($_POST['other7']);}$other8 = "";if (isset($_POST['other8'])) { $other8 = mysql_real_escape_string($_POST['other8']);}$other9 = "";if (isset($_POST['other9'])) { $other9 = mysql_real_escape_string($_POST['other9']);}$other10 = "";if (isset($_POST['other10'])) { $other10 = mysql_real_escape_string($_POST['other10']);}$other11 = "";if (isset($_POST['other11'])) { $other11 = mysql_real_escape_string($_POST['other11']);} $arrErrors = array();if (isset($_POST['btnsubmit'])) { if ($propertyname == '') { $arrErrors['propertyname'] = 'Please enter the property name.'; } if ($time == '') { $arrErrors['time'] = 'Please enter the time for this clearing sale.'; } if ($accountname == '') { $arrErrors['accountname'] = 'Please enter the account name for this clearing sale.'; } if ($comments == '') { $arrErrors['comments'] = 'Please enter any comments for this clearing sale.'; } if ($comments == '') { $arrErrors['comments'] = 'Please enter any comments for this clearing sale.'; } if (($select1 == 'dozer') && ($txt1 == '')){ $arrErrors['txt1'] = 'Please enter the text for the dozer selection.'; } if (($select1 == 'farming') && ($txt2 == '')){ $arrErrors['txt2'] = 'Please enter the text for the farming selection.'; } if (($select1 == 'grain') && ($txt3 == '')){ $arrErrors['txt3'] = 'Please enter the text for the grain selection.'; } if (($select1 == 'haymaking') && ($txt4 == '')){ $arrErrors['txt4'] = 'Please enter the text for the haymaking selection.'; } if (($select1 == 'vehicles') && ($txt5 == '')){ $arrErrors['txt5'] = 'Please enter the text for the vehicles selection.'; } if (($select1 == 'tools') && ($txt6 == '')){ $arrErrors['txt6'] = 'Please enter the text for the tools selection.'; } if (($select1 == 'household') && ($txt7 == '')){ $arrErrors['txt7'] = 'Please enter the text for the household selection.'; } if (($select1 == 'livestock') && ($txt8 == '')){ $arrErrors['txt8'] = 'Please enter the text for the livestock selection.'; } if (($select1 == 'number') && ($txt9 == '')){ $arrErrors['txt9'] = 'Please enter the text for the number selection.'; } if (($select1 == 'refreshments') && ($txt10 == '')){ $arrErrors['txt10'] = 'Please enter the text for the refreshments selection.'; } if (($select1 == 'direction') && ($txt11 == '')){ $arrErrors['txt11'] = 'Please enter the text for the direction selection.'; } if (($select1 == 'other') && ($txt12 == '')){ $arrErrors['txt12'] = 'Please enter the text for the other selection.'; } if (($_POST['select1'] == 'other') && ($_POST['other1'] == '')) { $arrErrors['other1'] = 'Please enter a category in the other text box.'; } if (($_POST['select2'] == 'other') && ($_POST['other2'] == '')) { $arrErrors['other2'] = 'Please enter a category in the other text box.'; } if (($_POST['select3'] == 'other') && ($_POST['other3'] == '')) { $arrErrors['other3'] = 'Please enter a category in the other text box.'; } if (($_POST['select4'] == 'other') && ($_POST['other4'] == '')) { $arrErrors['other4'] = 'Please enter a category in the other text box.'; } if (($_POST['select5'] == 'other') && ($_POST['other5'] == '')) { $arrErrors['other5'] = 'Please enter a category in the other text box.'; } if (($_POST['select6'] == 'other') && ($_POST['other6'] == '')) { $arrErrors['other6'] = 'Please enter a category in the other text box.'; } if (($_POST['select7'] == 'other') && ($_POST['other7'] == '')) { $arrErrors['other7'] = 'Please enter a category in the other text box.'; } if (($_POST['select8'] == 'other') && ($_POST['other8'] == '')) { $arrErrors['other8'] = 'Please enter a category in the other text box.'; } if (($_POST['select9'] == 'other') && ($_POST['other9'] == '')) { $arrErrors['other9'] = 'Please enter a category in the other text box.'; } if (($_POST['select10'] == 'other') && ($_POST['other10'] == '')) { $arrErrors['other10'] = 'Please enter a category in the other text box.'; } if (($_POST['select11'] == 'other') && ($_POST['other11'] == '')) { $arrErrors['other11'] = 'Please enter a category in the other text box.'; }if (count($arrErrors) == 0) { if ($other1 != "") { $select1 = $other1; } else { $select1 = $select1; } if ($other2 != "") { $select2 = $other2; } else { $select2 = $select2; } if ($other3 != "") { $select3 = $other3; } else { $select3 = $select3; } if ($other4 != "") { $select4 = $other4; } else { $select4 = $select4; } if ($other5 != "") { $select5 = $other5; } else { $select5 = $select5; } if ($other6 != "") { $select6 = $other6; } else { $select6 = $select6; } if ($other7 != "") { $select7 = $other7; } else { $select7 = $select7; } if ($other8 != "") { $select8 = $other8; } else { $select8 = $select8; } if ($other9 != "") { $select9 = $other9; } else { $select9 = $select9; } if ($other10 != "") { $select10 = $other10; } else { $select10 = $select10; } if ($other11 != "") { $select11 = $other11; } else { $select11 = $select11; }$update = "UPDATE clearingsales SET propertyname = '".mysql_real_escape_string($propertyname)."', time = '".mysql_real_escape_string($time)."', accountname = '".mysql_real_escape_string($accountname)."', comments = '".mysql_real_escape_string($comments)."', select1 = '".mysql_real_escape_string($select1)."', txt1 = '".mysql_real_escape_string($txt1)."', select2 = '".mysql_real_escape_string($select2)."', txt2 = '".mysql_real_escape_string($txt2)."', select3 = '".mysql_real_escape_string($select3)."', txt3 = '".mysql_real_escape_string($txt3)."', select4 = '".mysql_real_escape_string($select4)."', txt4 = '".mysql_real_escape_string($txt4)."', select5 = '".mysql_real_escape_string($select5)."', txt5 = '".mysql_real_escape_string($txt5)."', select6 = '".mysql_real_escape_string($select6)."', txt6 = '".mysql_real_escape_string($txt6)."', select7 = '".mysql_real_escape_string($select7)."', txt7 = '".mysql_real_escape_string($txt7)."', select8 = '".mysql_real_escape_string($select8)."', txt8 = '".mysql_real_escape_string($txt8)."', select9 = '".mysql_real_escape_string($select9)."', txt9 = '".mysql_real_escape_string($txt9)."', select10 = '".mysql_real_escape_string($select10)."', txt10 = '".mysql_real_escape_string($txt10)."', select11 = '".mysql_real_escape_string($select11)."', txt11 = '".mysql_real_escape_string($txt11)."' WHERE id = '".mysql_real_escape_string($id)."'";if (mysql_query ($update)) { header ("Location: clearing_sale_edited.php?id=".$id); } else { print "<p>Could not update the entry because: <b>" . mysql_error() . "</b>. The query was $update.</p>"; } } else { // The error array had something in it. There was an error. // Start adding error text to an error string. $strError = '<div class="formerror"><p>Please check the following and try again:</p><ul>'; // Get each error and add it to the error string // as a list item. foreach ($arrErrors as $error) { $strError .= "<li>$error</li>"; } $strError .= '</ul></div>'; }}if (isset($_POST['btnpreview'])) { if ($propertyname == '') { $arrErrors['propertyname'] = 'Please enter the property name.'; } if ($time == '') { $arrErrors['time'] = 'Please enter the time for this clearing sale.'; } if ($accountname == '') { $arrErrors['accountname'] = 'Please enter the account name for this clearing sale.'; } if ($comments == '') { $arrErrors['comments'] = 'Please enter any comments for this clearing sale.'; } if ($comments == '') { $arrErrors['comments'] = 'Please enter any comments for this clearing sale.'; } if (($select1 == 'dozer') && ($txt1 == '')){ $arrErrors['txt1'] = 'Please enter the text for the dozer selection.'; } if (($select1 == 'farming') && ($txt2 == '')){ $arrErrors['txt2'] = 'Please enter the text for the farming selection.'; } if (($select1 == 'grain') && ($txt3 == '')){ $arrErrors['txt3'] = 'Please enter the text for the grain selection.'; } if (($select1 == 'haymaking') && ($txt4 == '')){ $arrErrors['txt4'] = 'Please enter the text for the haymaking selection.'; } if (($select1 == 'vehicles') && ($txt5 == '')){ $arrErrors['txt5'] = 'Please enter the text for the vehicles selection.'; } if (($select1 == 'tools') && ($txt6 == '')){ $arrErrors['txt6'] = 'Please enter the text for the tools selection.'; } if (($select1 == 'household') && ($txt7 == '')){ $arrErrors['txt7'] = 'Please enter the text for the household selection.'; } if (($select1 == 'livestock') && ($txt8 == '')){ $arrErrors['txt8'] = 'Please enter the text for the livestock selection.'; } if (($select1 == 'number') && ($txt9 == '')){ $arrErrors['txt9'] = 'Please enter the text for the number selection.'; } if (($select1 == 'refreshments') && ($txt10 == '')){ $arrErrors['txt10'] = 'Please enter the text for the refreshments selection.'; } if (($select1 == 'direction') && ($txt11 == '')){ $arrErrors['txt11'] = 'Please enter the text for the direction selection.'; } if (($select1 == 'other') && ($txt12 == '')){ $arrErrors['txt12'] = 'Please enter the text for the other selection.'; } if (($_POST['select1'] == 'other') && ($_POST['other1'] == '')) { $arrErrors['other1'] = 'Please enter a category in the other text box.'; } if (($_POST['select2'] == 'other') && ($_POST['other2'] == '')) { $arrErrors['other2'] = 'Please enter a category in the other text box.'; } if (($_POST['select3'] == 'other') && ($_POST['other3'] == '')) { $arrErrors['other3'] = 'Please enter a category in the other text box.'; } if (($_POST['select4'] == 'other') && ($_POST['other4'] == '')) { $arrErrors['other4'] = 'Please enter a category in the other text box.'; } if (($_POST['select5'] == 'other') && ($_POST['other5'] == '')) { $arrErrors['other5'] = 'Please enter a category in the other text box.'; } if (($_POST['select6'] == 'other') && ($_POST['other6'] == '')) { $arrErrors['other6'] = 'Please enter a category in the other text box.'; } if (($_POST['select7'] == 'other') && ($_POST['other7'] == '')) { $arrErrors['other7'] = 'Please enter a category in the other text box.'; } if (($_POST['select8'] == 'other') && ($_POST['other8'] == '')) { $arrErrors['other8'] = 'Please enter a category in the other text box.'; } if (($_POST['select9'] == 'other') && ($_POST['other9'] == '')) { $arrErrors['other9'] = 'Please enter a category in the other text box.'; } if (($_POST['select10'] == 'other') && ($_POST['other10'] == '')) { $arrErrors['other10'] = 'Please enter a category in the other text box.'; } if (($_POST['select11'] == 'other') && ($_POST['other11'] == '')) { $arrErrors['other11'] = 'Please enter a category in the other text box.'; }if (count($arrErrors) == 0) { if ($other1 != "") { $select1 = $other1; } else { $select1 = $select1; } if ($other2 != "") { $select2 = $other2; } else { $select2 = $select2; } if ($other3 != "") { $select3 = $other3; } else { $select3 = $select3; } if ($other4 != "") { $select4 = $other4; } else { $select4 = $select4; } if ($other5 != "") { $select5 = $other5; } else { $select5 = $select5; } if ($other6 != "") { $select6 = $other6; } else { $select6 = $select6; } if ($other7 != "") { $select7 = $other7; } else { $select7 = $select7; } if ($other8 != "") { $select8 = $other8; } else { $select8 = $select8; } if ($other9 != "") { $select9 = $other9; } else { $select9 = $select9; } if ($other10 != "") { $select10 = $other10; } else { $select10 = $select10; } if ($other11 != "") { $select11 = $other11; } else { $select11 = $select11; } echo "<b>Preview</b>:<br />"; echo "<center><b>".$propertyname."</b><br />"; echo $selectDay." ".$selectDate." ".$selectMonth." ".$selectYear." "; echo $time."<br />"; echo $accountname."</center><br />"; echo $comments."<br />"; echo "<div class=title2>".$select1.":</div> ".$txt1."<br />"; echo "<div class=title2>".$select2.":</div> ".$txt2."<br />"; echo "<div class=title2>".$select3.":</div> ".$txt3."<br />"; echo "<div class=title2>".$select4.":</div> ".$txt4."<br />"; echo "<div class=title2>".$select5.":</div> ".$txt5."<br />"; echo "<div class=title2>".$select6.":</div> ".$txt6."<br />"; echo "<div class=title2>".$select7.":</div> ".$txt7."<br />"; echo "<div class=title2>".$select8.":</div> ".$txt8."<br />"; echo "<div class=title2>".$select9.":</div> ".$txt9."<br />"; echo "<div class=title2>".$select10.":</div> ".$txt10."<br />"; echo "<div class=title2>".$select11.":</div> ".$txt11."<br />"; } else { // The error array had something in it. There was an error. // Start adding error text to an error string. $strError = '<div class="formerror"><p>Please check the following and try again:</p><ul>'; // Get each error and add it to the error string // as a list item. foreach ($arrErrors as $error) { $strError .= "<li>$error</li>"; } $strError .= '</ul></div>'; }}[/code]Here is the form code:[code=php:0]<form action="<?php echo $PHP_SELF; ?>?id=<?php $id ?>" method="post" name="clearingsaleForm" id="clearingsaleForm"> <div class="main"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="2"><?php if (isset($strError)) { echo $strError;}?></td> </tr> <tr> <td width="17%" height="67" valign="top">Property Name:</td> <td width="83%" valign="top"><p<?php if (!empty($arrErrors['propertyname'])) echo ' class="formerror"'; ?>><textarea name="propertyname" cols="50" rows="4"><?php if (mysql_affected_rows() >= 0) { echo $row['propertyname']; } else { echo $propertyname; } ?></textarea></td> </tr> <tr> <td valign="top">Date:</td> <td valign="top"><?php $now = time(); $lastDay = date("t", $now); $days = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"); $months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); $thisDay = date("l", $row['selectDay']); $thisDate = date("j", $row['selectDate']); $thisMonth = date("F", $row['selectMonth']); $thisYear = date("Y", $row['selectYear']); print "<select name=\"selectDay\" id=\"selectDay\">"; foreach($days as $a) { $selStr = $a == $thisDay ? " selected=\"selected\"" : ""; print "<option value=\"$a\"$selStr>$a</option>"; } print "</select>"; print "<select name=\"selectDate\" id=\"selectDate\">"; for($i=1; $i<=$lastDay; $i++) { $selStr = $i == $thisDate ? " selected=\"selected\"" : ""; print "<option value=\"$i\"$selStr>$i</option>"; } print "</select>"; print "<select name=\"selectMonth\" id=\"selectMonth\">"; foreach($months as $v) { $selStr = $v == $thisMonth ? " selected=\"selected\"" : ""; print "<option value=\"$v\"$selStr>$v</option>"; } print "</select>"; print "<select name=\"selectYear\" id=\"selectYear\">"; for($i=$thisYear; $i<$thisYear+30; $i++) { $selStr = $i == $thisYear ? " selected=\"selected\"" : ""; print "<option value=\"$i\"$selStr>$i</option>"; } print "</select>"; ?> commencing <p<?php if (!empty($arrErrors['time'])) echo ' class="formerror"'; ?>><input name="time" type="text" id="time" value="<?php if (mysql_affected_rows() >= 0) { echo $row['time']; } else { echo $time; } ?>" size="5" /></td> </tr> <tr> <td valign="top">Account Name:</td> <td valign="top"><p<?php if (!empty($arrErrors['accoutname'])) echo ' class="formerror"'; ?>><input name="accountname" type="text" id="accountname" value="<?php if (mysql_affected_rows() >= 0) { echo $row['accountname']; } else { echo $accountname; } ?>" size="50" /></td> </tr> <tr> <td valign="top">Comments:</td> <td valign="top"><p<?php if (!empty($arrErrors['comments'])) echo ' class="formerror"'; ?>><textarea name="comments" cols="50" rows="4" id="comments"><?php if (mysql_affected_rows() >= 0) { echo $row['comments']; } else { echo $comments; } ?></textarea></td> </tr> <tr> <td valign="top"><p<?php if (!empty($arrErrors['select1'])) echo ' class="formerror"'; ?>><?php $selects1 = array("Dozer, tractors and header", "Farming plant & implements", "Grain Equipment", "Haymaking", "Vehicles", "Tools & workshop", "Household", "Livestock", "Number system", "Refreshments", "Directions", "Other");$thisOption1 = $row['select1'];print "<select name=\"select1\" id=\"select1\" onchange=\"showTextField1(this);\">";foreach ($selects1 as $a) { $selst1 = $a == $thisOption1 ? " selected=\"selected\"" : ""; print "<option value=\"$a\" $selst1>$a</option>"; } ?><br /><p<?php if (!empty($arrErrors['other1'])) echo ' class="formerror"'; ?>><input type="text" name="other1" size="26" style="display: none;" value="<?php if (mysql_affected_rows() >= 0) { echo $row['other1']; } else { echo $other1; } ?>" /></td> <td valign="top"><p<?php if (!empty($arrErrors['txt1'])) echo ' class="formerror"'; ?>><textarea name="txt1" cols="50" rows="4" id="txt1"><?php if (mysql_affected_rows() >= 0) { echo $row['txt1']; } else { echo $txt1; } ?></textarea></td> </tr> <tr> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top"><p<?php if (!empty($arrErrors['select2'])) echo ' class="formerror"'; ?>><?php $selects2 = array("Dozer, tractors and header", "Farming plant & implements", "Grain Equipment", "Haymaking", "Vehicles", "Tools & workshop", "Household", "Livestock", "Number system", "Refreshments", "Directions", "Other");$thisOption2 = $row['select2'];print "<select name=\"select2\" id=\"select2\" onchange=\"showTextField2(this);\">";foreach ($selects2 as $b) { $selst2 = $b == $thisOption2 ? " selected=\"selected\"" : ""; print "<option value=\"$b\" $selst2>$b</option>"; } ?><br /><p<?php if (!empty($arrErrors['other2'])) echo ' class="formerror"'; ?>><input type="text" name="other2" size="26" style="display: none;" value="<?php if (mysql_affected_rows() >= 0) { echo $row['other2']; } else { echo $other2; } ?>" /></td> <td valign="top"><p<?php if (!empty($arrErrors['txt2'])) echo ' class="formerror"'; ?>><textarea name="txt2" cols="50" rows="4" id="txt2"><?php if (mysql_affected_rows() >= 0) { echo $row['txt2']; } else { echo $txt2; } ?></textarea></td> </tr> <tr> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top"><p<?php if (!empty($arrErrors['select3'])) echo ' class="formerror"'; ?>><?php $selects3 = array("Dozer, tractors and header", "Farming plant & implements", "Grain Equipment", "Haymaking", "Vehicles", "Tools & workshop", "Household", "Livestock", "Number system", "Refreshments", "Directions", "Other");$thisOption3 = $row['select3'];print "<select name=\"select3\" id=\"select3\" onchange=\"showTextField3(this);\">";foreach ($selects2 as $c) { $selst3 = $c == $thisOption3 ? " selected=\"selected\"" : ""; print "<option value=\"$b\" $selst3>$c</option>"; } ?><br /><p<?php if (!empty($arrErrors['other3'])) echo ' class="formerror"'; ?>><input type="text" name="other3" size="26" style="display: none;" value="<?php if (mysql_affected_rows() >= 0) { echo $row['other3']; } else { echo $other3; } ?>" /></td> <td valign="top"><p<?php if (!empty($arrErrors['txt3'])) echo ' class="formerror"'; ?>><textarea name="txt3" cols="50" rows="4" id="txt3"><?php if (mysql_affected_rows() >= 0) { echo $row['txt3']; } else { echo $txt3; } ?></textarea></td> </tr> <tr> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top"><p<?php if (!empty($arrErrors['select4'])) echo ' class="formerror"'; ?>><?php $selects4 = array("Dozer, tractors and header", "Farming plant & implements", "Grain Equipment", "Haymaking", "Vehicles", "Tools & workshop", "Household", "Livestock", "Number system", "Refreshments", "Directions", "Other");$thisOption4 = $row['select4'];print "<select name=\"select4\" id=\"select4\" onchange=\"showTextField4(this);\">";foreach ($selects4 as $d) { $selst4 = $d == $thisOption4 ? " selected=\"selected\"" : ""; print "<option value=\"$d\" $selst4>$d</option>"; } ?><br /><p<?php if (!empty($arrErrors['other4'])) echo ' class="formerror"'; ?>><input type="text" name="other4" size="26" style="display: none;" value="<?php if (mysql_affected_rows() >= 0) { echo $row['other4']; } else { echo $other4; } ?>" /></td> <td valign="top"><p<?php if (!empty($arrErrors['txt4'])) echo ' class="formerror"'; ?>><textarea name="txt4" cols="50" rows="4" id="txt4"><?php if (mysql_affected_rows() >= 0) { echo $row['txt4']; } else { echo $txt4; } ?></textarea></td> </tr> <tr> <td height="16" valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top"><p<?php if (!empty($arrErrors['select5'])) echo ' class="formerror"'; ?>><?php $selects5 = array("Dozer, tractors and header", "Farming plant & implements", "Grain Equipment", "Haymaking", "Vehicles", "Tools & workshop", "Household", "Livestock", "Number system", "Refreshments", "Directions", "Other");$thisOption5 = $row['select5'];print "<select name=\"select5\" id=\"select5\" onchange=\"showTextField5(this);\">";foreach ($selects5 as $e) { $selst5 = $e == $thisOption5 ? " selected=\"selected\"" : ""; print "<option value=\"$e\" $selst5>$e</option>"; } ?><br /><p<?php if (!empty($arrErrors['other5'])) echo ' class="formerror"'; ?>><input type="text" name="other5" size="26" style="display: none;" value="<?php if (mysql_affected_rows() >= 0) { echo $row['other5']; } else { echo $other5; } ?>" /></td> <td valign="top"><p<?php if (!empty($arrErrors['txt5'])) echo ' class="formerror"'; ?>><textarea name="txt5" cols="50" rows="4" id="txt5"><?php if (mysql_affected_rows() >= 0) { echo $row['txt5']; } else { echo $txt5; } ?></textarea></td> </tr> <tr> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top"><p<?php if (!empty($arrErrors['select6'])) echo ' class="formerror"'; ?>><?php $selects6 = array("Dozer, tractors and header", "Farming plant & implements", "Grain Equipment", "Haymaking", "Vehicles", "Tools & workshop", "Household", "Livestock", "Number system", "Refreshments", "Directions", "Other");$thisOption6 = $row['select6'];print "<select name=\"select6\" id=\"select6\" onchange=\"showTextField6(this);\">";foreach ($selects6 as $f) { $selst6 = $f == $thisOption6 ? " selected=\"selected\"" : ""; print "<option value=\"$f\" $selst6>$f</option>"; } ?><br /><p<?php if (!empty($arrErrors['other6'])) echo ' class="formerror"'; ?>><input type="text" name="other6" size="26" style="display: none;" value="<?php if (mysql_affected_rows() >= 0) { echo $row['other6']; } else { echo $other6; } ?>" /></td> <td valign="top"><p<?php if (!empty($arrErrors['txt6'])) echo ' class="formerror"'; ?>><textarea name="txt6" cols="50" rows="4" id="txt6"><?php if (mysql_affected_rows() >= 0) { echo $row['txt6']; } else { echo $txt6; } ?></textarea></td> </tr> <tr> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top"><p<?php if (!empty($arrErrors['select7'])) echo ' class="formerror"'; ?>><?php $selects7 = array("Dozer, tractors and header", "Farming plant & implements", "Grain Equipment", "Haymaking", "Vehicles", "Tools & workshop", "Household", "Livestock", "Number system", "Refreshments", "Directions", "Other");$thisOption7 = $row['select7'];print "<select name=\"select7\" id=\"select7\" onchange=\"showTextField7(this);\">";foreach ($selects7 as $g) { $selst7 = $g == $thisOption7 ? " selected=\"selected\"" : ""; print "<option value=\"$g\" $selst7>$g</option>"; } ?><br /><p<?php if (!empty($arrErrors['other7'])) echo ' class="formerror"'; ?>><input type="text" name="other7" size="26" style="display: none;" value="<?php if (mysql_affected_rows() >= 0) { echo $row['other7']; } else { echo $other7; } ?>" /></td> <td valign="top"><p<?php if (!empty($arrErrors['txt7'])) echo ' class="formerror"'; ?>><textarea name="txt7" cols="50" rows="4" id="txt7"><?php if (mysql_affected_rows() >= 0) { echo $row['txt7']; } else { echo $txt7; } ?></textarea></td> </tr> <tr> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top"><p<?php if (!empty($arrErrors['select8'])) echo ' class="formerror"'; ?>><?php $selects8 = array("Dozer, tractors and header", "Farming plant & implements", "Grain Equipment", "Haymaking", "Vehicles", "Tools & workshop", "Household", "Livestock", "Number system", "Refreshments", "Directions", "Other");$thisOption8 = $row['select8'];print "<select name=\"select8\" id=\"select8\" onchange=\"showTextField8(this);\">";foreach ($selects8 as $h) { $selst8 = $h == $thisOption8 ? " selected=\"selected\"" : ""; print "<option value=\"$h\" $selst8>$h</option>"; } ?><br /><p<?php if (!empty($arrErrors['other8'])) echo ' class="formerror"'; ?>><input type="text" name="other8" size="26" style="display: none;" value="<?php if (mysql_affected_rows() >= 0) { echo $row['other8']; } else { echo $other8; } ?>" /></td> <td valign="top"><p<?php if (!empty($arrErrors['txt8'])) echo ' class="formerror"'; ?>><textarea name="txt8" cols="50" rows="4" id="txt8"><?php if (mysql_affected_rows() >= 0) { echo $row['txt8']; } else { echo $txt8; } ?></textarea></td> </tr> <tr> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top"><p<?php if (!empty($arrErrors['select9'])) echo ' class="formerror"'; ?>><?php $selects9 = array("Dozer, tractors and header", "Farming plant & implements", "Grain Equipment", "Haymaking", "Vehicles", "Tools & workshop", "Household", "Livestock", "Number system", "Refreshments", "Directions", "Other");$thisOption9 = $row['select9'];print "<select name=\"select9\" id=\"select9\" onchange=\"showTextField9(this);\">";foreach ($selects9 as $i) { $selst9 = $i == $thisOption9 ? " selected=\"selected\"" : ""; print "<option value=\"$i\" $selst9>$i</option>"; } ?><br /><p<?php if (!empty($arrErrors['other9'])) echo ' class="formerror"'; ?>><input type="text" name="other9" size="26" style="display: none;" value="<?php if (mysql_affected_rows() >= 0) { echo $row['other9']; } else { echo $other9; } ?>" /></td> <td valign="top"><p<?php if (!empty($arrErrors['txt9'])) echo ' class="formerror"'; ?>><textarea name="txt9" cols="50" rows="4" id="txt9"><?php if (mysql_affected_rows() >= 0) { echo $row['txt9']; } else { echo $txt9; } ?></textarea></td> </tr> <tr> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top"><p<?php if (!empty($arrErrors['select10'])) echo ' class="formerror"'; ?>><?php $selects10 = array("Dozer, tractors and header", "Farming plant & implements", "Grain Equipment", "Haymaking", "Vehicles", "Tools & workshop", "Household", "Livestock", "Number system", "Refreshments", "Directions", "Other");$thisOption10 = $row['select10'];print "<select name=\"select10\" id=\"select10\" onchange=\"showTextField10(this);\">";foreach ($selects10 as $j) { $selst10 = $j == $thisOption10 ? " selected=\"selected\"" : ""; print "<option value=\"$j\" $selst10>$j</option>"; } ?><br /><p<?php if (!empty($arrErrors['other10'])) echo ' class="formerror"'; ?>><input type="text" name="other10" size="26" style="display: none;" value="<?php if (mysql_affected_rows() >= 0) { echo $row['other10']; } else { echo $other10; } ?>" /></td> <td valign="top"><p<?php if (!empty($arrErrors['txt10'])) echo ' class="formerror"'; ?>><textarea name="txt10" cols="50" rows="4" id="txt10"><?php if (mysql_affected_rows() >= 0) { echo $row['txt10']; } else { echo $txt10; } ?></textarea></td> </tr> <tr> <td valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td valign="top"><p<?php if (!empty($arrErrors['other11'])) echo ' class="formerror"'; ?>><?php $selects11 = array("Dozer, tractors and header", "Farming plant & implements", "Grain Equipment", "Haymaking", "Vehicles", "Tools & workshop", "Household", "Livestock", "Number system", "Refreshments", "Directions", "Other");$thisOption11 = $row['select11'];print "<select name=\"select11\" id=\"select11\" onchange=\"showTextField11(this);\">";foreach ($selects11 as $k) { $selst11 = $k == $thisOption11 ? " selected=\"selected\"" : ""; print "<option value=\"$k\" $selst11>$k</option>"; } ?><br /><p<?php if (!empty($arrErrors['other11'])) echo ' class="formerror"'; ?>><input type="text" name="other11" size="26" style="display: none;" value="<?php if (mysql_affected_rows() >= 0) { echo $row['other11']; } else { echo $other11; } ?>" /></td> <td valign="top"><p<?php if (!empty($arrErrors['txt11'])) echo ' class="formerror"'; ?>><textarea name="txt11" cols="50" rows="4" id="txt11"><?php if (mysql_affected_rows() >= 0) { echo $row['txt11']; } else { echo $txt11; } ?></textarea></td> </tr> <tr> <td colspan="2" valign="top"> </td> </tr> <tr> <td colspan="2" valign="top">Please press the submit only once.</td> </tr> <tr> <td colspan="2" valign="top"><input name="btnsubmit" type="submit" id="btnsubmit" value="SUBMIT" /> <input name="btnpreview" type="submit" id="btnpreview" value="PREVIEW" /> <input name="btnreset" type="reset" id="btnreset" value="RESET" /></td> </tr> </table> </div></form>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/36015-solved-not-updating/ Share on other sites More sharing options...
Asheeown Posted January 28, 2007 Share Posted January 28, 2007 Wow are you serious Quote Link to comment https://forums.phpfreaks.com/topic/36015-solved-not-updating/#findComment-170863 Share on other sites More sharing options...
marcus Posted January 28, 2007 Share Posted January 28, 2007 [quote author=Fearsoldier link=topic=124362.msg515116#msg515116 date=1169948400]Wow are you serious[/quote]I'm sure he is, now, if you have nothing to say, just don't say it at all. Quote Link to comment https://forums.phpfreaks.com/topic/36015-solved-not-updating/#findComment-170864 Share on other sites More sharing options...
bibby Posted January 28, 2007 Share Posted January 28, 2007 cturner, you defiantely need to learn how to use functions for repetitive tasks.If I find myself doing ANYTHING twice, it becomes a function.[url=http://us2.php.net/manual/en/language.functions.php]http://us2.php.net/manual/en/language.functions.php[/url]That aside, you have some error handling (visually checking the post), but you don't have the good stuff.If your query doesn't run, echo mysql_error();echo'ing out $update could help as well. I bet that the hint you want is in mysql_error(); Quote Link to comment https://forums.phpfreaks.com/topic/36015-solved-not-updating/#findComment-170867 Share on other sites More sharing options...
cturner Posted January 28, 2007 Author Share Posted January 28, 2007 Problem is now solved. It was just one stupid mistake I made with my code. Not putting echo before $id; in the form action. I must have panicked when it wasn't updating. Quote Link to comment https://forums.phpfreaks.com/topic/36015-solved-not-updating/#findComment-170914 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.