How to generate unique codes in PHP?

How do you embed HTML tags inside PHP codes?

  • we are divided to tasks, a person handles the back-end using PHP and i handle the interface using HTML and CSS. i have a problem on creating tables inside PHP codes since it is dynamically placing records unorganized, i need to construct tables to organize all data generated from PHP. i'm trying to design PHP-generated records inside a HTML table but i dont know how. NEED HELP PLEASE?

  • Answer:

    There are a few options that come to mind... 1. Create an HTML file, then have the php script insert the text from that file as part of the output. 2. You can use print or echo to display HTML. 3. Or, you can print the HTML outside of the PHP tags themselves. Examples: test.html World<BR> page.php <?PHP print "hello "; include ("test.html"); ?> This is a test<BR> <?php echo "The end."; ?> Output: Hello World This is a test The end. In your case, assume your database has the fields: firstname, lastname, phone and that you have defined $firstname, $lastname and $phone to represent them. You can display this as a table with the following: <table> <TR><TD>First Name</TD><TD>Last Name</TD><TD>Phone</TD></TR> <TR><TD><?php print $firstname; ?></TD><TD><?php print $lastname; ?></TD><TD><?php print $phone; ?></TD></TR> </TABLE> In this example, you are using php to insert values within the table itself.

billyBel... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

<?php echo "put HTML code here and turn double quotes into single quotes or use \" "; ?>

Long

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.