Hm, isn't that the same I said yestreday (you don't need set value for action):
<?php if($submit) // Or , if you want if($submit == 'Registrer') { } else { // Form comes here } ?> Afan ----- Original Message ----- From: Nicole Amashta To: [EMAIL PROTECTED] Sent: Tuesday, February 12, 2002 10:34 AM Subject: Re: [PHP-WIN] im so stupid AHA! That is it, and I've encountere this before. OK, actually $submit should be set. But do this instead: add a hidden tag to the form as such: ================= <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"> <input type="hidden" name="action" value="submit"> </form> ================= Then, in your php script, do this: if ( $action == "submit" ) { ## do the action here .... } ================ This is how I handle my forms. I use hidden tags with values that will most certainly be passed to the script. If the submit button is not clicked, that value doesn't get set, thus not showing up to the calling script. But, if you actually click the button, it will. If you are just hitting your "enter" or "spacebar" to submit the form, then the $submit is never set. -Nicole Amashta www.aeontrek.com ============================= "Court Shrock" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > > 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> > > I do not think that an input of type 'submit' will be submitted in the post > to the next page...you could verify this by doing a phpinfo at the top of > registrer.php....the only name/value pairs submitted in the above form > should be "fornavn" and "etternavn". > > > </body> > > </html> > > > > registrer.php -> > > > > <? > > IF (isset($submit)) > > ...and therefore, the above statement would fail because the $submit > variable is not set and therefore the intended code below would not be > executed.... > > > { > > $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!"); > > } > > ?> -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php