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
And you should use single quotes with echo (e.g. echo 'hello world'; ) unless you are echoing out a variable. Example:
PHP Code:
$name='Bob';
echo "Hi $name";
Though to be honest, I never see anybody do that. Everybody seems to separate the variables from the rest of the data when they're echoing something:
PHP Code:
$name='Bob';
echo 'Hi '.$name;
. joins 'Hi' and $name into one string.
This is one of the first questions I've ever tried to answer on this forum. I usually just ask questions. This one seemed so easy, though, I thought I'd give it a try. I hope I did good :3
The better I get at programming, the more I appreciate arrays. Handy dandy things they are.
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
Thats just a link to a different page, that works perfectly fine in html, However your echoing means
1. Your actually sitting inside a .php file not an .html file
OR
2. 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
For instance
HTML Code:
<a href="google.com">Google</a>
That would redirect your current page to Google.com, So lets say your current URL is
yourwebsite.com
and on yourwebsite.com there is a link to a php file
HTML Code:
<!-- 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
yourwebsite.com/simple.php
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
Last edited by Nvenom; 07-25-2012 at 02:49 AM.
Albert Einstein ~ "Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Things To help you on this Site
1. Place all php code in [php] Tags 2. Place all html code in [html] Tags 3. Remember to mark all your Threads Resolved using thead tools at the top when your problem is solved
Bookmarks