ok, i have a page that adds content to a database that gets pulled off the the database on a diffrent page, how i would i make it so that i can edit the content put in the database off the first page using Dreamweaver MX, like i know that there is a edit/update server binding, and i set it to a form, but like i dont know how to make it so that it knows what entry i want to edit. like if i wanted to edit id 1 id 2 ect... this is my code.
CODE
<?php require_once('../Connections/conn.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 = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE compsci1_2 SET title=%s WHERE main=%s",
GetSQLValueString($HTTP_POST_VARS['title'], "text"),
GetSQLValueString($HTTP_POST_VARS['main'], "text"));
mysql_select_db($database_conn, $conn);
$Result1 = mysql_query($updateSQL, $conn) or die(mysql_error());
$updateGoTo = "../compsci1_2.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_conn, $conn);
$query_cs1_2Update = "SELECT * FROM compsci1_2";
$cs1_2Update = mysql_query($query_cs1_2Update, $conn) or die(mysql_error());
$row_cs1_2Update = mysql_fetch_assoc($cs1_2Update);
$totalRows_cs1_2Update = mysql_num_rows($cs1_2Update);
?>
<HTML><!-- InstanceBegin template="/Templates/index.dwt" codeOutsideHTMLIsLocked="false" -->
<HEAD>
<!-- InstanceBeginEditable name="doctitle" -->
<TITLE>index</TITLE>
<!-- InstanceEndEditable -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" -->
<link href="../Templates/styles.css" rel="stylesheet" type="text/css">
<!-- InstanceEndEditable -->
<link href="styles.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<TABLE WIDTH=100% BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
<TR>
<TD COLSPAN=2 background="../images/index_03.gif"><img src="../images/index_01.gif" width="143" height="85">
</TD>
<TD COLSPAN=4 background="../images/index_03.gif"><img src="../images/index_02.gif" width="301" height="85">
</TD>
<TD COLSPAN=4 background="../images/index_03.gif"> </TD>
</TR>
<TR>
<TD background="../images/index_11_bg.gif"> <a href="#"><IMG SRC="../images/index_04.gif" ALT="" WIDTH=56 HEIGHT=29 border="0"></a></TD>
<TD COLSPAN=2 background="../images/index_11_bg.gif"> <a href="#"><IMG SRC="../images/index_05.jpg" ALT="" WIDTH=100 HEIGHT=29 border="0"></a></TD>
<TD background="../images/index_11_bg.gif"> <a href="#"><IMG SRC="../images/index_06.gif" ALT="" WIDTH=102 HEIGHT=29 border="0"></a></TD>
<TD background="../images/index_11_bg.gif"> <a href="#"><IMG SRC="../images/index_07.gif" ALT="" WIDTH=99 HEIGHT=29 border="0"></a></TD>
<TD COLSPAN=2 background="../images/index_11_bg.gif"> <a href="#"><IMG SRC="../images/index_08.gif" ALT="" WIDTH=104 HEIGHT=29 border="0"></a></TD>
<TD background="../images/index_11_bg.gif"> <a href="#"><IMG SRC="../images/index_09.gif" ALT="" WIDTH=111 HEIGHT=29 border="0"></a></TD>
<TD background="../images/index_11_bg.gif"> <a href="#"><IMG SRC="../images/index_10.gif" ALT="" WIDTH=99 HEIGHT=29 border="0"></a></TD>
<TD background="../images/index_11_bg.gif"> <a href="#"><IMG SRC="../images/index_11.gif" ALT="" WIDTH=89 HEIGHT=29 border="0"></a></TD>
</TR>
<TR>
<TD COLSPAN=10><br>
<table width="90%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr>
<td bgcolor="#339933"><!-- InstanceBeginEditable name="title" --><span class="title">Title
of Page Goes here!</span><!-- InstanceEndEditable --></td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" class="main"><br>
<table width="95%" border="0" align="center" class="inner">
<tr>
<td valign="top"><!-- InstanceBeginEditable name="main" -->
<form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<p>Title :
<input name="title" type="text" id="title" value="Computer Science 1 & 2" size="27">
<br>
Main Content:<br>
<textarea name="main" cols="80" rows="10" wrap="OFF" id="main"></textarea>
<br>
<br>
<input type="submit" name="Submit" value="Submit">
</p>
<input type="hidden" name="MM_insert" value="form1">
<input type="hidden" name="MM_update" value="form1">
</form>
<!-- InstanceEndEditable --></td>
</tr>
</table>
<br>
</td>
</tr>
</table> </TD>
</TR>
<TR>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=56 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=87 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=13 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=102 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=99 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=87 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=17 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=111 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=99 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=89 HEIGHT=1 ALT=""></TD>
</TR>
</TABLE>
</BODY>
<!-- InstanceEnd --></HTML>
<?php
mysql_free_result($cs1_2Update);
?>