Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Aug 2005
    Posts
    365
    Thanks
    7
    Thanked 1 Time in 1 Post

    Question How to right html code in php - please help

    Dear all,
    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.

    Please help...
    Regards,
    Uzair

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,531
    Thanks
    8
    Thanked 1,091 Times in 1,082 Posts
    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).

    Example:

    PHP Code:
    <html>
    <head><title>my test</title>
    <body>

    <?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 ?>

    </body>
    </html>
    Last edited by mlseim; 08-12-2007 at 02:23 PM.

  • #3
    Regular Coder
    Join Date
    Aug 2005
    Posts
    365
    Thanks
    7
    Thanked 1 Time in 1 Post
    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...

    Regards

  • #4
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry.

    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •