aargh!! :mad:
I reallydon't understand! ... I've cleaned up the page and removed lots of code and all that was not strictly necessary but it still doesn't work!
Can anybody see anything wrong with the code below?
<?php
require 'php_scripts/db_connect.php';
// require our database connection
// which also contains the check_login.php
// script. We have $logged_in for use.
if ($logged_in == 0) {
die('Sorry you are not logged in, this area is restricted to registered members. <a href="login.php">Click here</a> to log in.');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="content-type" content="text/html;charset=iso-8859-1">
<META name="generator" content="Adobe GoLive 6">
<TITLE>Jedworth.co.uk - Edit your poem</TITLE>
<link rel="stylesheet" href="/style.css" type="text/css">
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<TABLE WIDTH=800 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD COLSPAN=2>[code=php]<?php
include( 'http://www.jedworth.co.uk/includes/header.php');
?>[/code]</TD>
</TR>
<TR>
<TD COLSPAN=2>
<HR>
</TD>
</TR>
<TR>
<TD valign="top">
<?php
include( 'http://www.jedworth.co.uk/includes/leftmenu.php');
?>
</TD>
<TD align="left" valign="top" width="674">
<H1>Poems</H1>
<H2>Edit your poem</H2>
<p></p>
<P>Here you will have the opportunity to add a poem with some additional information regarding that poem. You will also have the opportunity to upload or specify a picture to show when that poem is displayed on the web site.</P>
<P></P>
<?php
include( 'php_scripts/dbinfo.php' );
if (isset($_REQUEST['submitted'])) {
$poem_title = $_POST['poem_title'];
$poem_datewritten = $_POST['poem_datawritten'];
$poem_author = $_POST['poem_author'];
$poem_description = $_POST['poem_description'];
$poem_poem = $_POST['poem_poem'];
$poemid = $_POST['poemID'];
$db = mysql_pconnect( $dbhost, $dbuser, $dbpass );
mysql_select_db($dbname,$db);
$sql = "UPDATE poems SET poemtitle='$poem_title', poemdate='$poem_datewritten', poemauthor='$poem_author', poemdescription='$poem_description', poemtext='$poem_poem' WHERE poemID=$poemid";
// $sql = "UPDATE poems SET poemtitle='$poem_title', poemdate=$poem_datewritten, poemauthor=$poem_author, poemdescription=$poem_description, poemtext=$poem_poem WHERE poemID=$poemid";
mysql_query($sql,$db);
echo '<pre>';
print_r($_POST);
echo '</pre><br>';
ECHO "Poem updated! <br>Details:<br>no file uploaded<br>";
ECHO "poem title: $poem_title<br>\n";
ECHO "poem date written: $poem_datewritten<br>\n";
ECHO "poem author: $poem_author<br>\n";
ECHO "poem description: $poem_description<br>\n";
ECHO "poem: $poem_poem<br>\n";
ECHO "<br>\n";
}
else
{
#--------------------------------#
# HTML FORM
#--------------------------------#
?>
<form enctype="multipart/form-data" action="<?= $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="submitted" value="true">
[code=php]<?php
$codeid=$HTTP_GET_VARS['poemid'];
?>
<?php
$conn = mysql_connect( $dbhost, $dbuser, $dbpass );
mysql_select_db($dbname);
$sql = 'SELECT poemtitle,poemdate,poemdescription,poemauthor,poemtext,poemID FROM poems where poemID =' . $codeid;
// . ' AND poemauthor=' .$_SESSION['username']
$poemResult = mysql_query( $sql );
$poemRow = mysql_fetch_row( $poemResult );
ECHO '<input type="hidden" name="poemID" value="' .$poemRow[6] .'">';
ECHO 'Poem title<br>';
ECHO '<input type="Text" name="poem_title" size="33" value="' .$poemRow[0] .'"><br>';
ECHO '<input type="hidden" name="poem_author" size="25" value="' . $_SESSION["username"] . '">';
ECHO 'Date written<br>';
ECHO '<input type="Text" name="poem_datewritten" size="25" value="' . $poemRow[1] . '"><br>';
// ECHO 'Upload this file (optional):<br>';
// ECHO '<input name="' . $upload_file_name . '" type="file" value="' . $poemRow[5] . '"><br>';
ECHO 'Description<br>';
ECHO '<TEXTAREA name="poem_description" rows="8" cols="60">' . $poemRow[2] . '</TEXTAREA><br>';
ECHO 'Poem<br>';
ECHO '<TEXTAREA name="poem_poem" rows="24" cols="60">' . $poemRow[4] . '</TEXTAREA><br>';
mysql_close ($conn);
?>
[/code]
<br>
<input type="submit" value="Update Poem"></P>
</form>
<hr>
<?php
}
?>
<P></P>
</TD>
</TR>
</TABLE>
<?php
include( 'http://www.jedworth.co.uk/includes/footer.php');
?>
</BODY>
</HTML>
thanks,
Elroy