ciao, sto provando questo script per l'inserimento di autori in un db:
Codice PHP:
<html>
<body>
<?php
if (isset($_POST['name']));
$dbcnx = mysql_connect('localhost', 'user', 'pwdl');
if (!dbcnx) {
exit('
Unable to connect to the ' .
'database server at this time.</p>');
}
if (!mysql_select_db('ijdb')) {
exit('
Unable to locate the joketables ' .
'database at this time.</p>');
}
$name = $_POST['name'];
$email = $_POST['email'];
$sql = "INSERT INTO author SET
name='$name',
email='$email'";
if (mysql_query($sql)) {
echo '
New author added</p>';
} else {
echo '
Error adding new author: ' .
mysql_error() . '</p>';
}
?>
[url="<?php echo $_SERVER['PHP_SELF']; ?>"]Add another author[/url]</p>
[url="authors.php"]Return to aughors list[/url]</p>
<?php else: // Allow the user to enter a new author ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
Enter the new author:</p>
<label>Name: <input type="text" name="name" /></label>
<label>Email: <input type="text" name="email" /></label>
<input type="submit" value="SUBMIT" />
</form>
<?php endif; ?>
</body>
</html>
ma mi torna un errore su questa riga:
Codice PHP:
<?php endif; ?>
cosa c'è che non va?
grazie