Jump to content

php form


dick220369

Recommended Posts

i have the following form which is self referencing meaning that when the details are filled in and submitted the page reloads. i have been asked as part of a uni assignment to implement php code to make the form disappear or be hidden on the page when the page has reloaded and after the data has been submitted.

 

someone has suggested using

 

<?php

 

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

  // do form processing

}else {

  // display the form.

}

?>

 

but i don't know exactly where within my html to put this code. any suggestions?

 

 

i can't find any relevant material online that provides any where near a solution to this problem.

 

<form name="feedbackForm" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>" onsubmit="return validation(this);" onsubmit="input.php">

        <table cellpadding="10px" width="100%">

          <tr>

            <td colspan="4" class="required">Items marked (required) must be filled in before the form can be submitted!!!!</td>

          </tr>

          <tr>

            <td>First Name:</td>

            <td><input type ="text" size ="30" maxlength ="40" name="firstname"></td>

            <td>Surname:</td>

            <td><input type="text" Size="30" maxlength="40" name="surname"></td>

          </tr>

          <tr>

            <td>E-mail:<br>(required)</td>

            <td><input type="text" Size="30" maxlength="40" name="email"></td>

            <td>Comments:<br>(required)</td>

            <td><textarea rows="5" cols="50" name="comments"></textarea></td>

          </tr>

          <tr>

            <td colspan="2"><input type="submit" value="Submit"></td>

            <td colspan="2"><input type="reset" value="Reset"></td>

          </tr>

          <tr>

            <td>The current time is:</td>

            <td id="thetime"></td>

          </tr>

          <tr>

            <td><?php echo "Session start time - server side:";?></td>

            <td><?php echo date('H:i');?></td>

          </tr>

          <tr>

            <td>Session start time - client side:</td>

          </tr>

        </table>

      </form>

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/140067-php-form/
Share on other sites


<?php

if (isset($_POST['submit'])) {
   // do form processing
}else {
?>
<form name="feedbackForm" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>" onsubmit="return validation(this);" onsubmit="input.php">
        <table cellpadding="10px" width="100%">
          <tr>
            <td colspan="4" class="required">Items marked (required) must be filled in before the form can be submitted!!!!</td>
          </tr>
          <tr>
            <td>First Name:</td>
            <td><input type ="text" size ="30" maxlength ="40" name="firstname"></td>
            <td>Surname:</td>
            <td><input type="text" Size="30" maxlength="40" name="surname"></td>
          </tr>
          <tr>
            <td>E-mail:<br>(required)</td>
            <td><input type="text" Size="30" maxlength="40" name="email"></td>
            <td>Comments:<br>(required)</td>
            <td><textarea rows="5" cols="50" name="comments"></textarea></td>
          </tr>
          <tr>
            <td colspan="2"><input type="submit" value="Submit"></td>
            <td colspan="2"><input type="reset" value="Reset"></td>
          </tr>
          <tr>
            <td>The current time is:</td>
            <td id="thetime"></td>
          </tr>
          <tr>
            <td><?php echo "Session start time - server side:";?></td>
            <td><?php echo date('H:i');?></td>
          </tr>
          <tr>
            <td>Session start time - client side:</td>
          </tr>
        </table>
      </form>
      <?php
}
?>

Link to comment
https://forums.phpfreaks.com/topic/140067-php-form/#findComment-732893
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.