Cytat
Parse error: syntax error, unexpected 'endif' (T_ENDIF) in line 72
jest to ten kod:
Kod
<?php endif ?>
Cały kod:
Kod
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>CMS kawałów: Dodawanie nowego autora</title>
<meta http-equiv="content-type"
content="text/html; charset=iso-8859-2"/>
</head>
<body>
<?php
$dbcnx = @mysql_connect('localhost', 'root', 't43476931');
if(!$dbcnx) {
exit('<p> nie można w tej chwili ' .
'skontaktować się z serwerem bazy danych.</p>');
}
if (!@mysql_select_db('mydb')) {
exit('<p>Nie można w tej chwili ' .
'zlokalizować bazy danych.</p>');
}
$name = $_POST['name'];
$email = $_POST['email'];
$id = $_POST['id'];
$sql = "UPDATE autor SET
nazwa='$name',
email='$email'
WHERE id='$id'";
if (@mysql_query($sql)) {
echo '<p>Dodano nowego autora</p>';
} else {
echo '<p>Problem podczas dodawania nowego autora: ' .
mysql_error() . '</p>';
}
?>
<p><a href="authors.php">Powrót do listy autorów</a></p>
<?php
$id = $_GET['id'];
$author = @mysql_query(
"SELECT nazwa, email FROM autor WHERE id='$id'");
if (!$author) {
exit('<p>Problem podczas pobierania danych autora: ' .
mysql_error() . '</p>');
}
$author = mysql_fetch_array($author);
$name = $author['nazwa'];
$email = $author['email'];
$name = htmlspecialchars($name);
$email = htmlspecialchars($email);
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<p>Edytuj autora:</p>
<label>Nazwisko: <input type="text" name="name" value="<?php echo $name; ?>" /></label><br />
<label>Email: <input type="text" name="email" value="<?php $email; ?>" /></label><br />
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="submit" value="Akceptuj" /></p>
</form>
<?php endif ?>
</body>
</html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>CMS kawałów: Dodawanie nowego autora</title>
<meta http-equiv="content-type"
content="text/html; charset=iso-8859-2"/>
</head>
<body>
<?php
$dbcnx = @mysql_connect('localhost', 'root', 't43476931');
if(!$dbcnx) {
exit('<p> nie można w tej chwili ' .
'skontaktować się z serwerem bazy danych.</p>');
}
if (!@mysql_select_db('mydb')) {
exit('<p>Nie można w tej chwili ' .
'zlokalizować bazy danych.</p>');
}
$name = $_POST['name'];
$email = $_POST['email'];
$id = $_POST['id'];
$sql = "UPDATE autor SET
nazwa='$name',
email='$email'
WHERE id='$id'";
if (@mysql_query($sql)) {
echo '<p>Dodano nowego autora</p>';
} else {
echo '<p>Problem podczas dodawania nowego autora: ' .
mysql_error() . '</p>';
}
?>
<p><a href="authors.php">Powrót do listy autorów</a></p>
<?php
$id = $_GET['id'];
$author = @mysql_query(
"SELECT nazwa, email FROM autor WHERE id='$id'");
if (!$author) {
exit('<p>Problem podczas pobierania danych autora: ' .
mysql_error() . '</p>');
}
$author = mysql_fetch_array($author);
$name = $author['nazwa'];
$email = $author['email'];
$name = htmlspecialchars($name);
$email = htmlspecialchars($email);
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<p>Edytuj autora:</p>
<label>Nazwisko: <input type="text" name="name" value="<?php echo $name; ?>" /></label><br />
<label>Email: <input type="text" name="email" value="<?php $email; ?>" /></label><br />
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="submit" value="Akceptuj" /></p>
</form>
<?php endif ?>
</body>
</html>