html - Show dynamic website on DIV or other element form, php, php function

Solution:
A function cannot be defined inside an "if" block. You can call it within an "if" block, but should not define.
Here's the working code.
function myfunction() {
$title = $_POST['title'];
$url = $_POST['url'];
$message = $_POST['message'];
echo "<br>" . $title . "<br >". $url . "<br />" . $message;
}
if(!empty($_POST['title']) && !empty($_POST['url']) && !empty($_POST['message']) )
{
myfunction();
}
It's a good idea to use empty() with $_POST
Answer
Solution:
You can also useisset()
function myfunction() {
$title = $_POST['title'];
$url = $_POST['url'];
$message = $_POST['message'];
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><head><title>Title WEB</title><meta http-equiv="content-type" content="text/html;charset=utf-8" />';
echo '<style> body { width: 100%; margin: 0; padding: 0; } </style></head><body>';
echo "<br />" . $title . "<br /><br />" . $url . "<br /><br />" . $message;
echo "</body></html>";
}
if(isset($_POST['title'] && $_POST['url'] && $_POST['message'])) {
myfunction();
}
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: gd library extension not available with this php installation.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.