
Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tlug] empty rows (PostgreSQL)
- Date: Fri, 11 Feb 2005 13:37:33 +0900
- From: Ahmed Sarwar <qqw99xk9@example.com>
- Subject: [tlug] empty rows (PostgreSQL)
Hi, bellow is the form I can add data with. The porblem is
it adds data even if the form is empty. How can I stop this?
Please reply if anyone have time. Thanks in advace.
<?
if ($_POST['submit'] != "Add")
{
?>
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="POST">
Name:<br>
<input name="name" type="text" size="20">
<p>
<input type="submit" name="submit" value="Add">
</form>
<?
}
else
{
$connection = pg_connect("dbname=db");
if (!$connection)
{
die("Could not open connection to database server");
}
$query = "INSERT INTO name VALUES(nextval('name_id_seq'), '$name')";
$result = pg_query($connection, $query) or die("Error in query:$query. " . pg_last_error($connection));
echo "Data successfully added.";
pg_close($connection);
}
?>
Home |
Main Index |
Thread Index