0

I am creating a portal. When the user is logged in, the control goes to portal.php. In the portal.php page, I use the following code:

<?php
    session_start();
?>
<html>
    <head>
        <title></title>
        <link>many link tags are use </link>
    </head>
    <body>
        ------------------------(portal)----------------------------
        -------------too much long html page using css,JavaScript,php,bootstrap-----------------
    </body>
</html>

PHP works fine when I use HTML at least, but when I use long HTML in PHP creates an error!

Note: I am using PhpStorm as IDE in which "502 Bad Gateway" error generate!

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Bilal Ahmad
  • 75
  • 1
  • 7
  • Are you sure there is no php code anywhere in that cut off code? Looks to me as server error was generated due error in php code on server side. Check server logs for error description. – SoLaR Jan 07 '20 at 07:31
  • 1
    *"502 Bad Gateway"* -- this suggests that you are using PhpStorm's built-in simple web server (it can sometime throw 502 errors for a valid code). I suggest using proper web server (Apache/nginx/IIS/etc) to serve your web pages. – LazyOne Jan 07 '20 at 10:47
  • Just to follow up on a comment above: https://www.jetbrains.com/help/phpstorm/installing-an-amp-package.html – Dmitrii Jan 07 '20 at 17:30

1 Answers1

0

Brother if you share your code chunk then it will be very easy to understand that where you are stucking.

you cando like the example below,

source How to write html code inside <?php ?>

 <?php
         echo "<table>";
         echo "<tr>";
         echo "<td>Name</td>";
         echo "<td>".$name."</td>";
         echo "</tr>";
         echo "</table>";
    ?>

another example you can try

<?php 
    $name='your name';
    echo '<table>
       <tr><th>Name</th></tr>
       <tr><td>'.$name.'</td></tr>
    </table>';
?>

for javascript

source https://www.geeksforgeeks.org/how-to-run-javascript-from-php

 <?php  
    echo '<script type="text/JavaScript">  
         prompt("GeeksForGeeks"); 
         </script>' 
    ; 
    ?> 

you can visit the below link a similar question has been answered there.

How to concatenate html stylized table with php and sql

fahad patel
  • 379
  • 3
  • 8