08-12-2007, 01:05 PM
I know a way to write html in php >>> echo("html code");
But this is not good as when a user views the page source, the code is there.
but I want to know how to write html tables in php code not using echo or print.
08-12-2007, 01:20 PM
When you view a PHP page, you'll only see the HTML, not the PHP scripts.
You can mix HTML with PHP (but you still need the file extension to be .php).
echo "this is the PHP script inside the HTML part";
$date = date("M/d/Y");
Now, we're out of PHP and back to regular HTML<br>
To display PHP variables outside of PHP, you do it like this:<br>
The Date is <?=$date?><br><br>
Notice how the PHP variable is between <? and ?>
08-12-2007, 06:36 PM
Thank you for replying sir. But I think I couldn't tell you what actually I want.
All I want is to write a HTML Table in PHP code. If I echo or print the html code then the user is able to see its code (using view source). I dont want the user to see my code. That's y I want to write the table in PHP. I have the page with extention .php. Please guide me writing a table in PHP only.
Waiting for reply...
08-12-2007, 07:03 PM
There is no way to hide the HTML markup from the people that use your site. You can try to obfuscate it or make it more confusing to understand, but you absolutely have to send it to them. Otherwise, how would their browsers know what to display?
When someone makes a webpage in PHP, they write the code that generates the HTML. You still have to send that output to your users.