RE: [PHP-WIN] im so stupid

From: Date: Mon, 11 Feb 2002 16:18:04 +0000
Subject: RE: [PHP-WIN] im so stupid
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-12003@lists.php.net to get a copy of this message
I may be being dafter, but are these on different pages? If not then they should be in my mind... The form should be on an html page, posting to a seperate php page, unless there are some other indentifying shenanigans that you're not showing us just now. registrer.html -> <html> <head></head> <body><form method="post" action="registrer.php"> Fornavn: <input type="text" name="fornavn"><br> Etternavn: <input type="text" name="etternavn"><br> <input type="Submit" name="submit" value="Registrer"><br> </form> </body> </html> registrer.php -> <? IF (isset($submit)) { $hostname = "dbname"; $username = "chris"; $password = "*****"; $dbname = "chris"; MSSQL_CONNECT($hostname,$username,$password); mssql_select_db($dbname); $sql = "insert into studenter(fornavn, etternavn) values ('$fornavn','$etternavn')"; $result = mssql_query($sql); $studentnummer = mssql_insert_id(); Print("Studenten er lagt inn!"); } ?> -----Original Message----- From: chris [mailto:tometerlaks@hotmail.com] Sent: 11 February 2002 11:10 To: php-windows@lists.php.net Subject: [PHP-WIN] im so stupid I have made a script and for some reason i dont understand it doesnt do what its supposed to. maybe you can tell me whats wrong. its a form where im supposed to insert a new record in a mssql table. but when i hit submit it just refreshes blank. <html> <head></head> <body><form method="post" action="registrer.php"> Fornavn: <input type="text" name="fornavn"><br> Etternavn: <input type="text" name="etternavn"><br> <input type="Submit" name="submit" value="Registrer"><br> </form> <? IF (isset($submit)) { $hostname = "dbname"; $username = "chris"; $password = "*****"; $dbname = "chris"; MSSQL_CONNECT($hostname,$username,$password); mssql_select_db($dbname); $sql = "insert into studenter(fornavn, etternavn) values ('$fornavn','$etternavn')"; $result = mssql_query($sql); $studentnummer = mssql_insert_id(); Print("Studenten er lagt inn!"); } ?> </body> </html> hope you can help. -Chris -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.windows (#12003) next »