Skip to main content
added 15 characters in body
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237
  1. Headers - why not? You can fine tune your cache control. They are not neccessarynecessary but they aren't harming anything either as long as that's how you want your caching set.

  2. No, but you should. It causes no harm and makes your application more organized and easier to understand.

  3. Technically no, because if $_POST['lastname']$_POST['lastname'] is empty nothing will be displayed anyway. But having it explicitly like you do is better, in case you want to append or prepend anything to it in the future. For example if you want to do

    " . $_POST['lastname'] . ""; ?>
     <?php echo "Lastname: <h3>" . $_POST['lastname'] . "</h3>"; ?> 
    

Then it will print with an empty value even if it's not present. If you want something to only print if it's available, set it with a condition like you have it now.

  1. Indentation is fine.

  2. yesYes, you could have your HTML standalone and just send requests to the PHP file. It's just a matter of choice. Personally I make most everything into templates anyway and put them into the PHP with require_once()require_once().

  3. That part doesn't matter, if I were you I'd likely separate them out anyway.

  1. Headers - why not? You can fine tune your cache control. They are not neccessary but they aren't harming anything either as long as that's how you want your caching set.

  2. No, but you should. It causes no harm and makes your application more organized and easier to understand.

  3. Technically no, because if $_POST['lastname'] is empty nothing will be displayed anyway. But having it explicitly like you do is better, in case you want to append or prepend anything to it in the future. For example if you want to do

    " . $_POST['lastname'] . ""; ?>

Then it will print with an empty value even if it's not present. If you want something to only print if it's available, set it with a condition like you have it now.

  1. Indentation is fine.

  2. yes could have your HTML standalone and just send requests to the PHP file. It's just a matter of choice. Personally I make most everything into templates anyway and put them into the PHP with require_once()

  3. That part doesn't matter, if I were you I'd likely separate them out anyway.

  1. Headers - why not? You can fine tune your cache control. They are not necessary but they aren't harming anything either as long as that's how you want your caching set.

  2. No, but you should. It causes no harm and makes your application more organized and easier to understand.

  3. Technically no, because if $_POST['lastname'] is empty nothing will be displayed anyway. But having it explicitly like you do is better, in case you want to append or prepend anything to it in the future. For example if you want to do

     <?php echo "Lastname: <h3>" . $_POST['lastname'] . "</h3>"; ?> 
    

Then it will print with an empty value even if it's not present. If you want something to only print if it's available, set it with a condition like you have it now.

  1. Indentation is fine.

  2. Yes, you could have your HTML standalone and just send requests to the PHP file. It's just a matter of choice. Personally I make most everything into templates anyway and put them into the PHP with require_once().

  3. That part doesn't matter, if I were you I'd likely separate them out anyway.

Source Link

  1. Headers - why not? You can fine tune your cache control. They are not neccessary but they aren't harming anything either as long as that's how you want your caching set.

  2. No, but you should. It causes no harm and makes your application more organized and easier to understand.

  3. Technically no, because if $_POST['lastname'] is empty nothing will be displayed anyway. But having it explicitly like you do is better, in case you want to append or prepend anything to it in the future. For example if you want to do

    " . $_POST['lastname'] . ""; ?>

Then it will print with an empty value even if it's not present. If you want something to only print if it's available, set it with a condition like you have it now.

  1. Indentation is fine.

  2. yes could have your HTML standalone and just send requests to the PHP file. It's just a matter of choice. Personally I make most everything into templates anyway and put them into the PHP with require_once()

  3. That part doesn't matter, if I were you I'd likely separate them out anyway.