You are doing nothing wrong as such (Although some critics may claim its sloppy coding, which personally i think is trash!). All that it is, is that PHP is warning you that you are using a variable which does not have a value assigned to it. Since this is from a form page, the most likely problem is to do with 'Register Globals'.
When a form is submitted to a page, PHP takes the form details and creates the variables again. Rather than creating '$custname = value', PHP now puts all the values into a 'super-global array'. Basically, since your form uses post to send the details, your variable is created in your script as $_POST["custname"] $_POST is the post superglobal. It contains all the values which come to your script via a 'post' request. There are similar arrays for $_SESSION variables, $_GET variables, $_COOKIE variables and so on. If you have a problem finding out where your values have gone, a simple call to phpinfo(32); will show you all the variables in your script which you can access/use. You can also find more infomation on superglobals at: http://www.php.net/manual/en/security.registerglobals.php http://www.php.net/manual/en/language.variables.predefined.php#language.vari ables.superglobals To stop the notice coming up in the future (i.e. if you do want to use an empty variable for something) simply go to your php.ini and find error reporting. Changing error_reporting = E_ALL to error_reporting = E_ALL & ~E_NOTICE will stop those notices poping up in the future. Hope this answers your question. Any more problems, don't hesitate to email again ----- Original Message ----- From: "Stephen Goehler" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, January 16, 2003 8:49 PM Subject: [PHP-INST] Undefined variable > Hey all, > Thanks in advance for your help... > > I'm getting an undefined variable error in my code, and I'm not sure what is > wrong. I just installed PHP, which is why I am posting here. > > Contents of the HTML Form: > <form action="test.php" method=POST> > <input type="text" name="custname"> > <input type=submit name="Submit" value="Submit"> > </form> > > Contents of test.php: > <? > echo "<p>Here are the results:</p>"; > echo date("H:i, jS F"); > echo $custname; > ?> > > I'm getting the following error: > NOTICE: undefined variable: custname on > d://**path here**/test.php on line 4. > > (i just put "path name" rather than type out the whole long string) > > I am running win 2000 server and using IIS 5.0. I ran the PHP installer and > then added phpisapi to the windows directory and then added the phpisapi > filter in IIS. The date above comes up correctly, but I can't get any > variables to move over from the form to the php file. > > I searched through the help files and through a couple newsgroups with no > luck. What am I doing wrong? > > Thanks! > > Steve > > > > -- > PHP Install Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Install Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php