PHP Novice to Ninja Page. 119 Problem

Hello to everyone.
I have these three files:

form.html.php

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Add joke</title>
  
</head>
<body>
<form action="?" method="post">
	<div> <label for="joketext">Type your joke:</label> </div>
	<textarea id="joketext" name="joketext" rows="3" cols="40"></textarea>
	<div><input type="submit" value="Add"></div>
 </form>
</body>
</html>

jokes.html.php

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Amministrazione Joke</title>
</head>
<body>

<p><a href="?addjoke">Add your own joke</a></p>

</body>
</html>

index.php

<?php
if (isset($_GET['addjoke']))
{
  include 'form.html.php';
  exit();
}
?>

When I click on link “Add your own joke”, I do not display the form. Why?

Thank you

given that this is your complete code, why should it display the form? when you load jokes.html.php and you click on the link you load jokes.html.php?addjoke. and since there is no PHP in that page there is no reason why index.php should be executed.

Sorry It’s my stupid error.

Thank you for your quick answer and for your time

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.