Important to mention, that the reason why the $variable
probably doesnt work is that your service provider has turned off the globals. In this case you would need, as Zhuravlev mentions, use $_POST["variable"] to insert the records. All in all, since the factory setting in the new versions of PHP are Globals off, using POST and GET is much better practise, so just start using it, :) And ofcourse : If U are using GET method in your form, then you use the $_GET["variable"] instead. You probably also know, that the way U are writing your code isnt very handy in the long run, if you alter your database you will need to recode all the pages that inserts anything. You probably know the names of your table, so I would recommend you do this instead : Say the table is like this, and to quicken my typing I assume globals is on, :) id first last phone You would write : insert into contacts values ('','$first','$last','$phpne'); You should write this : insert into contacts (first,last,phone) VALUES ('$first','$last','$phone'); WHY? If you alter your table, insert a new row or remove one, your example will fail mySQL and result in an error since the query doesnt match the table. In my example it will have no difference, aslong as first,last and phone are still in the table. The autoincrement value will still be updated as intended, aslong as the table is correctly formatted (and it is, since your first example works). Kim "Zhuravlev Alexander" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Tue, Nov 11, 2003 at 07:44:58PM -0800, Mark wrote: > > I am following the tutorial at > > http://www.freewebmasterhelp.com/tutorials/phpmysql/ > > The source code is on the website on the left hand side > > http://www.freewebmasterhelp.com/static/tutorials/phpmysql/example.zip > > > > > > My software: > > PHP version 4.3.4 on Windows 2000 > > MYSQL version 4.0.16 on Windows 2000 > > Apache version 1.3.29 on Windows 2000 > > > > The problem is I cannot get the database to add a new records aside from > > the auto-increment field. All the other fields are left blank when the > > add.html is subitted. > > > > I have the add.html with the following code exactly the same as the > > source code. > > > > <form action="insert.php" method="post"> > > First Name: <input type="text" name="first"><br> > > Last Name: <input type="text" name="last"><br> > > Phone: <input type="text" name="phone"><br> > > Mobile: <input type="text" name="mobile"><br> > > Fax: <input type="text" name="fax"><br> > > E-mail: <input type="text" name="email"><br> > > Web: <input type="text" name="web"><br> > > <input type="Submit"> > > </form> > > > > > > The insert.php > > <? > > include("dbinfo.inc.php"); > > mysql_connect(localhost,$username,$password); > > @mysql_select_db($database) or die( "Unable to select database"); > > > > $query = "INSERT INTO contacts VALUES > > ('','$first','$last','$phone','$mobile','$fax','$email','$web')"; > > http://ru3.php.net/manual/en/security.registerglobals.php > > try > $query = "insert into contacts values ('',".$_POST['first'].",".$_POST['last'].",".$_POST['phone'].",".$_POST['mob ile'],",".$_POST['fax'].",".$_POST['email'].",".$_POST['web'].")"; > > and so on ... > > > mysql_query($query); > > > > mysql_close(); > > ?> > > > > > > > > Any help would be much appreciated. > > > > Regards, > > Mark > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- zhuravlev alexander > u l s t u n o c > ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php