Home > other >  Overwrite HTML with PHP
Overwrite HTML with PHP

Time:04-26

I want to overwrite html code by php based on a variable. How can I do that? My code:

$variable = true;
if(!$variable)
{
    //send this html code to the client
}
//if that condition is false - do nothing (aka display normal content)

CodePudding user response:

You cannot "overwrite" HTML code. Once it is sent, there is nothing you can do about it (I'll leave output buffering out of context now).

What you want though is covered an all PHP tutorials out there, so you should be able to figure this out yourself. If you have done that research and are still struggling, feel free to ask again here.

But, to give you a hint, check out else, or die().

  •  Tags:  
  • php
  • Related