Hi

Well...

If you look at your script, you'll see that you are trying to test on $submit, the 
'problem' is that you have not defined $submit, not as a local var and not as a var 
from eg a URL, in other words: You are trying to test on something that you have not 
yet defined - IMHO 'sloppy' code. 

You can however remove the error message by using the error_reporting() or change 
error_reporting in the php.ini, but the best solution is to either test if the var 
isset or define and assign it before using it !

eg:

if(isset($submit) && $submit === true)
{
....
}

Best
Steen


"Eugene Wolff" <[EMAIL PROTECTED]> wrote:
> Hi,
>  
> I have the following script.  When I open it says: 
>  
> Notice: Undefined variable: submit in
> c:\inetpub\wwwroot\phpTest9.php on
> line 4
> Although the input boxes all show fine.  Obviously it does
> not do the
> first part of the code because ($submit) is not equal to
> true.
>  
> <html>
> <body>
> <?php
> if ($submit){
>   //Process form
>   $db = mysql_connect("eugene","root");
>   mysql_select_db("mydetailsonline",$db);
>   $sql="insert into employees
> (first_name,last_name,cell_phone,home_phone) values
> ('$first_name','$last_name','$address','$position')";
>   $result=mysql_query($sql);
>   echo "Thank you! information entered.\n";
> }else{
>   //display form
>   ?>
> <form method="post" action="<?php echo
> $_SERVER['PHP_SELF']?>">
> First name:<input type="Text" name="first_name"><br>
> Last name:<input type="Text" name="last_name"><br>
> CellPhone:<input type="Text" name="Cell_phone"><br>
> Home phone:<input type="Text" name="home_phone"><br>
> <input type="Submit" name="submit" value="Enter
> information">
> </form>
> <?php
> } //end if
> ?>
> </body>
> </html>
>  
> Thanks again
>  
> Eugene


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

Reply via email to