I have made an age calculator using PHP. It works fine in localhost/age/age-calculator.php
I have moved this file as a wp theme-page-template theme/mytheme/page-template/age-calculator.php
<?php get_header();
/*
Template Name: Age Calculator
*/
Create a page and linked with this page-template.
The input forms working nicely but when submit data. WordPress doesn't show me any result and bring me on the home page.
But in localhost, I am getting input result on the same page
How to show the result on the wp page template?
Thanks
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method='post'>
<div class="container bg-light p-2 wow bounceInUp">
<div class="row">
<div class="col-sm-6 mb-4">
<p> Your Name * </p>
<input type="text" name='person_1' placeholder="Name" <?php echo "$required $all_required";?> />
<p class="text-danger"> <?php echo " $nameErr ";?> </p>
<br/>
<p> Date of Birth * </p>
<input type="date" name='birth_date' <?php echo "$required $all_required";?> />
<p class="text-danger"> <?php echo " $dateErr ";?> </p>
<br/>
<input class="btn-success" type="submit" value='Calculate Yours Age' name='submit_1' /> <br/>
</div>
<div class="col-sm-6">
<p> Your Friend's Name * </p>
<input type="text" name='person_2' placeholder= "Friend's Name " <?php echo "$all_required";?> />
<p class="text-danger"> <?php echo " $nameErr2 ";?> </p>
<br />
<p> Your Friend's Date of birth * </p>
<input type="date" name='birth_date_2' <?php echo "$all_required";?> />
<p class="text-danger"> <?php echo " $dateErr2 ";?> </p>
<br /><br />
</div>
</div>
<div class="row">
<input class='m-auto btn btn-success p-2' type="submit" value='Compare Age' name='submit_all' />
</div>
</div>
</form>
<form>
tag look like? Does it have amethod
and anaction
?