Jump to content

Recommended Posts

I have done most of my coding using nothing but php and then echoing the html tags like so ..

 

echo "<p>HELLO WORLD</p>";

 

this is fine. But now I am using a tool that generates a lot of html and I would like to just include the tidbits of php within the code as follows:

 

html code

...

...

...

<?php insert some php code then close php tag ?>

...

...

...

more html code

...

...

done with html

 

 

My problem is that if I have a really big chunk of html code I may include a php tag near the top and declare a variable inside of that tag the close the tag. Then, later on in the html code I will insert another php tag, try to reference the variable declared in the earlier php tag above but the value is not retained. How can I keep the value and use it again ?

 

Thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/138818-help-using-php-tags-inside-html/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.