I am not sure if this is the right place to ask this naive question.

I got a simple form addform.html and add.php look like the following.
But everytime I got empty value from firstname and lastname. It seems like
the input value in the html page was not passed on to the php variable $firstname in 
add.php. Anyone give me a hand on this naive question?

Great thanks.


Wei


addform.html

<html>
<body>
<form action="add.php" method="post">
First Name : <input type="text" name="firstname" size="40" length="40" value=""><BR>
Surname : <input type="text" name="surname" size="40" length="40" value=""><BR>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="reset" value="Clear It">
</form>
</body>
</html>


add.php

<html>
<body>
<?php
$db = pg_connect("dbname=friends");
$query = "INSERT INTO friends (id, firstname, surname) values 
(nextval('friends_id_seq'), '$firstname', '$surname')";
$result = pg_exec($db, $query);
if (!$result) {
printf ("ERROR");
$errormessage = pg_errormessage($db);
echo $errormessage;
exit;
}
printf ("These values were inserted into the database - %s %s", $firstname, $surname);
pg_close();
?>
</body>
</html>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to