I have written a form on a page.php page (somewhat dynamically) and the action for the form is the page.php page.

Will this work correctly?

    Sure it will:

    <? 
    if (isset($_POST['submit']))
    {
     //ACTIONS IF PAGE IS SUBMITTED
    }
    else
    {
     //ACTIONS IF NOT SUBMITTED
    } ?>
    

      just keep this in mind: if you use

      if (isset($_POST['submit']))

      make sure your submit button looks like this:

      <input type="submit" name="submit" value="Submit This form">

      Where the name attribute is given and matches what you use with the isset() function. Also on your form action, to have php dynamically assign the script name to the form when it is submitted (so the form submits to the same page), you can use $PHP_SELF

      <form method="post" action="<?= $PHP_SELF ?>">

      Cgraz

        AAMOF, it can call itself as many times as you want to. Many small apps are all one script. Here's a basic layout for a messaging script I have up...the top is a bunch of output functions; the logic is about 20 lines, and basically goes as follows...

        keep in mind that conversion from $_POST array has already been done in variable checking...

        if (!$submit) {
          // display the original form
        
        elseif (($submit) && (!($sendmsg)))
          // do verification and if succesful, show the message form
        
        elseif (($submit) && ($sendmsg=="yes"))
           // do more verification and send the message

          Ok, I would have thought that it wouldn't have been a problem.

          My glitches are coming from somewhere else!

          marks thread resolved

            Write a Reply...