PHP if/else statement

前端 未结 6 370
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-20 23:29

I\'m a complete newbie to PHP but found it can be very useful. How can I write the following statement in PHP:

If body ID = \"home\" then insert some html, e.g.

6条回答
  •  囚心锁ツ
    2021-01-21 00:18

    Personally I think that the best way to do that without refreshing and without having to set a variable (like $body or something like that) is to use a javascript code, this because "communications" between JS & PHP is a one-way communication.

    
    

    otherwise you can build a form and then take the body.id value using $_GET function... It always depends on what you've to do after you now body.id value.

    Hope this will be usefull & clear.

提交回复
热议问题