I want to create table inside php script .. Is there any way that i could create table inside php script.?
<?php html code to create table ?>
Step 1: Firstly, we have to type the Html code in any text editor or open the existing Html file in the text editor in which we want to use the PHP. Step 2: Now, we have to place the cursor in any tag of the <body> tag where we want to add the code of PHP. And, then we have to type the start and end tag of PHP.
You can execute Javascript through PHP by calling javascript code/function as a string in PHP and send it to the client browser to execute.
Using echo or print: PHP echo or print can be used to display HTML markup, javascript, text or variables.
You can do like
HTML in PHP :
<?php echo "<table>"; echo "<tr>"; echo "<td>Name</td>"; echo "<td>".$name."</td>"; echo "</tr>"; echo "</table>"; ?>
Or You can write like.
PHP in HTML :
<?php /*Do some PHP calculation or something*/ ?> <table> <tr> <td>Name</td> <td><?php echo $name;?></td> </tr> </table>
<?php /*Do some PHP calculation or something*/ ?>
Means:
You can open a PHP tag with <?php
, now add your PHP code, then close the tag with ?>
and then write your html code. When needed to add more PHP, just open another PHP tag with <?php
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With