RE: [PHP-DB] undeclared variable error
| From: | Rick Emery | Date: | Wed, 13 Feb 2002 20:36:33 +0000 |
| Subject: | RE: [PHP-DB] undeclared variable error | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-16926@lists.php.net to get a copy of this message | ||
change:
<?php echo $PHP_SELF?>
to:
<?php echo $PHP_SELF;?>
note the semi-colon
-----Original Message-----
From: Dan Howard [mailto:dhoward@sorensontech.com]
Sent: Wednesday, February 13, 2002 2:34 PM
To: Rick Emery; php-db@lists.php.net
Subject: RE: [PHP-DB] undeclared variable error
Thanks Rick,
That took care of the $submit error, but I still have the following error
showing:
PHP Warning: Undefined variable: PHP_SELF in c:\inetpub\wwwroot\testform.php
on line 14
Here is line 14:
<form method="post" action="<?php echo $PHP_SELF?>">
I still don't know what's going on here.
Thanks for your patience and help for us newbies!
Dan
-----Original Message-----
From: Rick Emery [mailto:remery@excel.com]
Sent: Wednesday, February 13, 2002 12:11 PM
To: 'Dan Howard'; php-db@lists.php.net
Subject: RE: [PHP-DB] undeclared variable error
change:
if ($submit) {
to:
if (ISSET($submit)) {
-----Original Message-----
From: Dan Howard [mailto:dhoward@sorensontech.com]
Sent: Wednesday, February 13, 2002 12:21 PM
To: php-db@lists.php.net
Subject: [PHP-DB] undeclared variable error
Folks,
I am very new to PHP, and have been working through some tutorials. I have
been able to post data from mySQL, but when I tried to do a form page to
enter data into the database I get the following error:
PHP Warning: Undefined variable: submit in c:\inetpub\wwwroot\testform.php
on line 4 PHP Warning: Undefined variable: PHP_SELF in
c:\inetpub\wwwroot\testform.php on line 14
Here is the code:
<html>
<body>
<?php
if ($submit) {
// process form
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$sql = "INSERT INTO employees (first,last,address,position) VALUES
('$first','$last','$address','$position')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>">
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Address:<input type="Text" name="address"><br>
Position:<input type="Text" name="position"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
} // end if ?>
</body>
</html>
Does anyone have any ideas, or where I need to look more to learn what the
problem is here? TIA
Dan
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php