First off remember that PHP pages are not limited to purely writing PHP code. The PHP code is only inside of the <?php and ?> tags. Anything outside of those tags would not be PHP and could be anything that you could normally write in an HTML file. With a standard PHP file that is not going to be used as an include, you will have html tags in the file.
I am sure you know something about file types if you have made it this far. Simply put, make sure your files have the .php extension or else the server won’t process the code. If PHP is your first language other than HTML, CSS, and JavaScript, you will realize that PHP isn’t nearly as forgiving. Be consistent and use the proper syntax. Enough chatter, let’s write our first PHP script!
The command echo is one of the ways PHP can output content. So, basically we used the opening <?php tag to indicate that were starting to use PHP code. Then, we echo a string “I am awesome!”, which you are. And of course, we end our only statement with a standard ;. Finally, we tell the server that we no longer want to use PHP code and we close it with the ?> tag.
If you have this idea mastered, continue on to learn about the fundamental stones to craft a master PHP website.
And now I see why there are so many double comments….
Is the php supposed to be on multiple lines like that? It doesn’t seem to be working for me following the same format :p
Is the php supposed to be on multiple lines like that? It doesn’t seem to be working for me following the same format :p
OK, I don’t konw how to use it.
I wrote some PHP code in the input form, but I did not konw how to submit.
Just had a quick question.
Do HTA’s support PHP? I tried running a function using an input button, but when I try running the function I get an alert saying that "PHPTest() is null."
This is what I have written:
<html>
<head>
<title>New HTA</title>
<HTA: Application>
<link rel="stylesheet" type="text/css" href="C:\Styles\style.css">
</head>
<?PHP
function PHPTest()
{
echo "PHP Test";
}
?>
<body bgcolor="lightsteelblue">
<div class="button_format">
<form>
<input type="button" name="phptestbutton" value="PHP Test" onClick="PHPTest()">
</form>
</div>
</body>
</html>
————————————————————————————————————
I also tried writing:
<?PHP
echo "Test"
?>
inside the "body" tags, but still nothing. Anyone have any advice?
I learn something new everyday.This here is new to me.
Time to start studying PHP. Challenge accepted, going to read all these tutorials tonight.