title: Returning / redirecting to an anchored div after form submission
body: <p>as far as i studied in several posts, the following form should return to the div <code>#CCC</code> after submission</p>
  
  <pre><code>$editFormAction = $_SERVER['PHP_SELF']."#CCC";
  
  if ((isset($_POST["MM_update"])) &amp;&amp; ($_POST["MM_update"] == "formX")) { 
  $updateSQL = sprintf("UPDATE foodtable SET food_preference=%s  WHERE food_id=%s",    
                         GetSQLValueString($_POST['food_preference'], "text"),
                         GetSQLValueString($_POST['food_id'], "int"));
  
    mysql_select_db($database_XYZ, $XYZ);
    $Result1 = mysql_query($updateSQL, $XYZ) or die(mysql_error());
  
    $updateGoTo = "preference.php";
    if (isset($_SERVER['QUERY_STRING'])) {
      $updateGoTo .= (strpos($updateGoTo, '?')) ? "&amp;" : "?";
      $updateGoTo .= $_SERVER['QUERY_STRING'];
        }
    header(sprintf("Location: %s", $updateGoTo));
      exit ();
  }
  </code></pre>
  
  <hr>
  
  <pre><code>&lt;body&gt;
  
  &lt;div id ="AAA"&gt;
  &lt;p&gt;Some text&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;div id ="BBB"&gt;
  &lt;p&gt;Some more text&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;div id ="CCC"&gt;
       &lt;form action="&lt;?php echo $editFormAction; ?&gt;" method="post" name="formX" id="formX"&gt;
       &lt;table align="center"&gt;
       &lt;tr valign="baseline"&gt;
       &lt;td align="right" nowrap="nowrap"&gt;Update Food Name:&lt;/td&gt;
       &lt;td&gt;&lt;input type="text" name="food_name" value="" size="32" /&gt;&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr valign="baseline"&gt;
       &lt;td nowrap="nowrap" align="right"&gt;
       &lt;input type="hidden" name="MM_update" value="formX" /&gt;
       &lt;input type="hidden" name="food_id" value="&lt;?php echo $query['food_id']; ?&gt;" /&gt;
       &lt;/td&gt;
       &lt;td&gt;
       &lt;input type='submit' value='Update Food Name'/&gt;"
      &lt;/td&gt;
      &lt;/tr&gt;
      &lt;/table&gt;
     &lt;/form&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p>but it isn't returning to the div <code>#CCC</code> on submission. is there anything lacking in the above blocks of code?</p>
  
  <p>thanks,</p>