Beste allemaal

voor mijn eigen cms heb ik een edit pagina aangemaakt voor de artikelen op de voorpagina, het bericht wat je wil aanpassen kun je selecteren om hem daarna te kunnen editten. maar het lukt me niet om het juiste "id" te editten want hij stuurt me door naar de titel van de pagina ipv het id!
Hier onder de code.. Wan doe ik fout?? al vast bedankt!


<?php require_once('../Connections/***.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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"] == "form2")) {
  $insertSQL = sprintf("INSERT INTO content (voorpagina, `Voorpagina titel`) VALUES (%s, %s)",
                       GetSQLValueString($_POST['voorpagina'], "text"),
                       GetSQLValueString($_POST['Voorpagina_titel'], "text"));

  mysql_select_db($database_RCM, $RCM);
  $Result1 = mysql_query($insertSQL, $RCM) or die(mysql_error());
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE content SET paginaid=%s, `Voorpagina titel`=%s WHERE voorpagina=%s",
                       GetSQLValueString($_POST['paginaid'], "int"),
                       GetSQLValueString($_POST['Voorpagina_titel'], "text"),
                       GetSQLValueString($_POST['voorpagina'], "text"));

  mysql_select_db($database_RCM, $RCM);
  $Result1 = mysql_query($updateSQL, $RCM) or die(mysql_error());

  $updateGoTo = "editfrontpage.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}

mysql_select_db($database_RCM, $RCM);
$query_frontpage = "SELECT paginaid, voorpagina, `Voorpagina titel` FROM content";
$frontpage = mysql_query($query_frontpage, $RCM) or die(mysql_error());
$row_frontpage = mysql_fetch_assoc($frontpage);
$totalRows_frontpage = mysql_num_rows($frontpage);
?>
<?php include("configuration.php"); ?>
<?php echo "<link rel=\"stylesheet\" href=\"$GLOBALS[mosConfig_live_site]/test/css/template_css.css\" type=\"text/css\"/>" ; ?>
<html>
<head>
<script language="javascript" type="text/javascript" src="../tinyfck/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
<!--
tinyMCE.init({
	mode : "textareas",
	theme : "advanced",
	plugins : "style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
	theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
	theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
	theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
	theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_path_location : "bottom",
	extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
	template_external_list_url : "example_template_list.js"
});

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
  <table align="center">
    <tr valign="baseline">
      <td nowrap align="right">Paginaid:</td>
      <td><select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
        <option value="" <?php if (!(strcmp("", $row_frontpage['paginaid']))) {echo "selected=\"selected\"";} ?>>selecteer</option><?php
do {  
?>
        <option value="<?php echo $row_frontpage['paginaid']?>"<?php if (!(strcmp($row_frontpage['paginaid'], $row_frontpage['paginaid']))) {echo "selected=\"selected\"";} ?>><?php echo $row_frontpage['Voorpagina titel']?></option>
        <?php
} while ($row_frontpage = mysql_fetch_assoc($frontpage));
  $rows = mysql_num_rows($frontpage);
  if($rows > 0) {
      mysql_data_seek($frontpage, 0);
	  $row_frontpage = mysql_fetch_assoc($frontpage);
  }
?>
              </select>      </td>
    <tr>
    <tr valign="baseline">
      <td nowrap align="right">Voorpagina titel:</td>
      <td><input type="text" name="Voorpagina_titel" value="<?php echo $row_frontpage['Voorpagina titel']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right" valign="top">Voorpagina:</td>
      <td><textarea name="voorpagina" cols="90" rows="5"><?php echo $row_frontpage['voorpagina']; ?></textarea>
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">&nbsp;</td>
      <td><input name="Submit" type="submit" value="Update content">
        <label>
        <input type="reset" name="Submit2" value="Opnieuw">
      </label></td>
    </tr>
  </table>
  <input type="hidden" name="MM_update" value="form1">
  <input type="hidden" name="voorpagina" value="<?php echo $row_frontpage['voorpagina']; ?>">
</form>
<p>&nbsp;</p>
<?php
mysql_free_result($frontpage);
?>
het gaat dus vooral om dit stukje code.

<select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
        <option value="" <?php if (!(strcmp("", $row_frontpage['paginaid']))) {echo "selected=\"selected\"";} ?>>selecteer</option><?php
do {  
?>
        <option value="<?php echo $row_frontpage['paginaid']?>"<?php if (!(strcmp($row_frontpage['paginaid'], $row_frontpage['paginaid']))) {echo "selected=\"selected\"";} ?>><?php echo $row_frontpage['Voorpagina titel']?></option>
        <?php
} while ($row_frontpage = mysql_fetch_assoc($frontpage));
  $rows = mysql_num_rows($frontpage);
  if($rows > 0) {
      mysql_data_seek($frontpage, 0);
      $row_frontpage = mysql_fetch_assoc($frontpage);
  }
?>
              </select>
@Rick: * Bumpen * mag pas na 24 uur.

Reageren