I'm new to web programing, and so i spent almost 4 hours trying to open one php file from the button click event. in that time i red many posts that you cant call php file from html file and you need to use js to use ajax to call php and other confusing things but in the end
echo "<div class=\"mainmenu\">";
echo "<a href=\"teams.php\"><input id=\"buttons\" type=\"button\" value=\"Teams\"></a>";
worked. So im confused , is it "wrong" ?
Thats just a link to a different page, that works perfectly fine in html, However your echoing means
- Your actually sitting inside a .php file not an .html file
- You have a .htaccess file with AddType application/x-httpd-php .html/.htm
in it which allows php to be ran through an html/htm page.
And im just basing that all off the fact you are using Echo's, and those have no place in html
That would redirect your current page to Google.com, So lets say your current URL is
and on yourwebsite.com there is a link to a php file
<!-- yourwebsite.com -->
<a href="simple.php">Redirect to php page</a>
When i click that <a> tag (called an Anchor) it will change my URL to
When you sit on the main domain of a website for instance google.com
your actually on a sub page but the browser hides the default file name from you.
So when you go to yourwebsite.com you are actually on yourwebsite.com/index.html or yourwebsite.com/index.php (even though .html has more priority in terms of structure over .php file extensions)
I know its confusing just do some googling and reading of the anchor tag and you will get it