Is it possible to write a code using html5 css3 javascript and php?

+3 yannick aremou · December 18, 2014
Is it possible to write a code using html5 css3 javascript and php?all in the same code for a website?thank you

Post a Reply

Replies

Oldest  Newest  Rating
+1 Steven the awesome · December 18, 2014
What do you mean?
+1 Sašo Plut · December 18, 2014
You can use everything inside a PHP code.. don't have any examples at the moment but if you really need them i can browse some simple website i did for an assignment..
+1 yannick aremou · December 19, 2014
thank you. that would help. 
+1 Steven the awesome · December 19, 2014
You can do this for example. 





<?php

echo  "<h1>Hello World!</h1>";


?>


+1 Steven the awesome · December 19, 2014
Yepp that's a really good point you must edit you file extension to .php. 
+1 Branislav Lazic · December 19, 2014
Yes of course. And oh! Pro tip: Don't mix your code (i.e. PHP, JS, CSS in one file)! That's called "macaroni code"
+1 Sašo Plut · December 19, 2014
Found those examples. Just make a php file. you can write an html code inside it but every time you need a php code just put it in <?php code ?>. i have a seperate file for css but it can be put in as well.. JS the same but i did not use it in this code..
just please for the love of god don't put all the code in one file..
my index.php from waaay back


<!DOCTYPE html>
<html> 
    <?php
                    session_start();
                    
    ?>
<head>
    <link rel="stylesheet" type="text/css" href="template.css" />
<meta charset="UTF-8"> 
<title>Seminarska</title> 
</head>
<body>

<div id="container">
<div id="header">
<h1>
Seminarska
</h1>
</div>
<div id="navigation">
<ul>


</ul>
</div>
<div id="content-container">
<div id="content">
                    <?php
                    
                        if (isset($_SESSION['login'])&& $_SESSION['name']!='admin'){
                    include('igra.html');
                    }
                    else if (isset($_SESSION['login']) && $_SESSION['name']=='admin'){
                        include('admin.php'); 
                        
                    }
                    else{
                        include('brez.html');
                    }
                    
                    ?>
                    
                    
</div>
<div id="aside">
                    
                    <?php
                    
                    if (!isset($_SESSION['login'])){
                        ?>
                    
<h3>
Login
</h3>
                    
                        <form action="login.php" method="post">
                            Username: <input type="text" name="username" /><br />
                            Password: <input type="password" name="password" /><br />
 
                             <input type="submit" name="submit" value="Login" />
                        </form>
                    <?php
                    }
                    else{
                        echo "<p>Logged in successfully</p>";
                    ?> 
                     <a href="logout.php">Log Out</a>
                        <?php    
                    }
                    ?>
</div>
<div id="footer">
Copyright © Site name, 20XX
</div>
</div>
</div>  
    
</body> 
</html>
+3 Muamet Shasivari · December 19, 2014
I say,YES
0 yannick aremou · December 20, 2014
thank you everyone
  • 1

HTML / CSS / Web Design

107,353 followers
About

Discuss, share, ask, learn and teach HTML5 and CSS3.

Links
Moderators