...

View Full Version : help with php edit script



Hitman
02-25-2007, 11:04 AM
hello guys i want to create a php scripts that would edit and the chapter title and number under the book title category... how can i do it please help thanks

here is my script


<?php



ini_set ('display_errors',1);

error_reporting (E_ALL & ~E_NOTICE);



ob_start();



include ("includes/header.inc");



if (isset ($_POST['submit'])) {



$book = $_POST['booktitle'];

$cookie = 0;



include ("dbconnection.php");



$result = mysql_query("UPDATE book SET booktitle = '{$_POST['booktitle']}' , bookdesc = '{$_POST['bookdesc']}' WHERE bookid = '{$_POST['bookid']}'");







if ($result == 1) {





echo '<div align="center"><b>The Book as updated.</b><br /><br /><a href="addbooks.php"><font color="blue"><b>Back</b></font></a>';





} else {



echo "Could not add the entry because:

<b>" . mysql_error() . "</b>. The query was $query.</p>";



}





mysql_close();

}



?>



<form action="editbook.php" method="post" enctype="multipart/form-data" name="form1">

<table width="570" height="293" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td width="124" height="30"><div align="right"><strong>Select Book:</strong></div></td>

<td width="9">&nbsp;</td>

<td width="429"><select name="position1" id="position1">



<?



include("dbconnection.php");





$position1 = mysql_query("SELECT bookid, booktitle from book order by booktitle");



while($row = mysql_fetch_array($position1, MYSQL_NUM)) {





echo "<option value=\"$row[0]\">$row[1]</option>\n";

}



?>

</select></td>

</tr>

<tr>

<td height="31"><div align="right"><strong>Book Title:</strong></div></td>

<td>&nbsp;</td>

<td><input name="booktitle" type="text" size="40"></td>

</tr>

<tr>

<td height="200"><div align="right"><strong>Book Description:</strong></div></td>

<td>&nbsp;</td>

<td><textarea name="bookdesc" cols="40" rows = "10" colums = "100"></textarea></td>

</tr>

<tr>

<td height="30">&nbsp;</td>

<td>&nbsp;</td>

<td><input type="submit" name="submit" value="submit"></td>

</tr>

</table>

</form>

<?



include ("includes/footer.inc");



?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum