Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi all

how do i can send some php and html (or only php or only html) to one page(fix page) and show code result ?

for example create a fix page with name showresult.php

when send

XML
<!DOCTYPE html>
<html>
<body>

<?php
echo "My first PHP script!";
?>

</body>
</html>


showresult.php display
My first PHP script!


i want a thing like w3schools but simple

please help me

thanks a lot
Posted

1 solution

if you are trying to include a php script in html document then you can do something like this.

//ShowResult.php

PHP
<?php 
$var = "Hello World";
?>


//yourpage.html

HTML
 <html>
<head> <?php include "ShowResult.php" ;?> </head>
 <body>

<?php  echo $var; ?>
</body>
</html>

</html>


What I have done here is to simply create an external php file called "ShowResult.php" where I create a variable called var and assigned it a value of "Hello World". In the html file called "yourpage.html" I have called the php file using the php "include" function.

In you can apply this principle in other situations to call an external php script in your html file. have a look here for more help.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900