Re: value passing from html form to php variable.
| From: | Sander Roobol | Date: | Sat, 01 Jun 2002 16:14:28 +0000 |
| Subject: | Re: value passing from html form to php variable. | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-84664@lists.php.net to get a copy of this message | ||
This is not the right place to ask support questions. Ask them on php-general@lists.php.net. See http://php.net/support for a complete list of places where you can ask support.
Anyway, read http://www.php.net/release_4_2_0.php to see what you're doing wrong (especially, read the part about External variables)
Sander
On 2002.06.01 17:33 Wei Wang wrote:
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 Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php