I have made a site in Wordpress.
In my front-page.php
and in my index.php
files I entered both post and get methods just to echo a message in page-message.php
file.
When I click the subscribe button the posts page:news
appears.The posts page:news
is defined in my Wordpress settings: dashboard=>settings=>reading=>Front page displays=>a static page.
In page-message.php
I wanted to show the data I had entered from this form. T
Code for the forms:
<h2>Sign to Newsletter</h2>
<form action="page-message.php" method="post">
Name:<input class="input" type="text" name="name" value=""/><br/>
Email:<input type="text" name="email" value=""/>
<br/><input class="submit" type="submit" value="Subscribe"/>
</form>
Code for page-message.php:
<?php
$name = $_POST["name"];
$email = $_POST["email"];
echo 'Congratulations!You have been successfully subscribed to our newsletter' .$name .$email;
?>
When I click the subscribe button my url changes to http://localhost/wordpress/page-message.php?name=stergios&email=something%40someone.com
.
This seems to be correct when using the post method. The problem is the content!
It always loads the news (posts page from settings =>reading) and not the simple echo message?
It always shows the posts page when I write anything beyond my pages in the url. For example the url localhost/wordpress/hhhhhhhhhhh
(a page that does not exist) does load the posts page and not a message error!