Как да редактирам ?

zlatincho0

Registered
Здравейте значи имам една книга за гости която си правих но .. нещоо немога да направя заявката за да мога да ги редактирам ..
От този файт добавям самите въпроси/коментари както щете ги наричайте ..

PHP:
<?php
include "config.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="bg" xml:lang="bg">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> ADD </title>
<body bgcolor="#666666" />
<?php
if ($_POST['submit'])
{
	$name = htmlspecialchars($_POST['name']);
	$email = htmlspecialchars($_POST['email']);
	$grad = htmlspecialchars($_POST['grad']);
	$text = htmlspecialchars($_POST['text']);
	
$sql = " INSERT INTO kniga (name , email , grad , text) VALUE ('$name' , '$email' , '$grad' , '$text' )";
$result = mysql_query($sql) or die (mysql_error());
echo "Успешно писа в книгата за гости ! ... <br />";
echo "<a href='index.php'>Върнисе в началото</a>";
}
else
{
echo "<center><form method='post' action='add.php'>
	<input type='hidden' name='hidden' />
	Име:<br /><input type='text' name='name' /><br />
	Email:<br/> <input type='text' name='email' /><br />
	Град: <br /> <input type='text' name='grad' /> <br />
	Текст: <br /> <textarea type='text' name='text' cols='25' rows='6' /></textarea><br />
	<input type='submit' name='submit' value='Добави' />
	</form> </center>
";
}
?>

А това ми е индекса в който изкарвам резултатите


PHP:
<?php
include "config.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="bg" xml:lang="bg">
<html>
<head>
<body>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Книга за гости / Начало</title>
<body bgcolor="#e3e3e3" />
<style type="text/css">

#menu {
	width: 750px;
	height: 100px;
	background-color: #474747;
	border: 9px selid #F4F4F4;
}
.name {
	background-color: #A2B5CD;
	color: #ffffff;
	border: 1px selid #ffffff;
	padding: 1px;
	margin: 1px;
}
.text {
	background-color: #;
	color: #ffffff;
	padding: 0px;
	margin: 2px;
	
}

.asd{
	background-color: #ababab;
	color: #ffffff;
	border: 1px selid #ffffff;
	
	width: 100px;
	height: 99;
}
</style>
	<?php
	echo "<center>";
	echo "<p class='asd' width='22px'><a href='add.php'>Добави запис<a/></p>";
	echo "<center>";
	$sql = "SELECT * FROM kniga order by id DESC LIMIT 0,5";
	$result = mysql_query($sql) or die (mysql_error());

	while ($date = mysql_fetch_assoc($result)) {
	echo "<div id='menu'>
	<p class='name'>Добавил : $date[name]</p> <br />
	<p class='text'>$date[text]</p>

</div>
	";
	}
	?>
</body>
</html>
Моля ви помогнете искам дамога да ги едитвам в базата данни примерно имам запис с ИД 2 и да стане така
edit.php?id=2 и тнт .. :) мерси предварително ! :)
 

Back
Горе