PHP is server side language. In typical php web application development, you write php files to read request payload, process the data, retrieve the data from databases, transform it and send it back to the clients.
Once a request come to the php file, server takes the php file, process the information and convert the php snippet to respective html code and send back to the browser.
For example, as you see the contents of post_form.php file, it contains both html and php code. When request comes to this php file, server executes the business logic written in this php file and send the response back to the browser.
post_form.php
<form method = "POST">
<label for = "name">Enter your name:</label>
<input type = "text" name = "name"/><br />
<button type="submit">Submit</button>
</form>
<?php
if(isset($_POST['name'])){
$my_name = $_POST['name'];
echo "Hello $my_name, very good morning!!!!!";
}
?>
Can I write php in html files?
No, you can write html in php files, but you can’t write php in html files.
Previous Next Home
No comments:
Post a Comment