beginner php

Started by
9 comments, last by Unduli 6 years, 11 months ago

<!DOCTYPE html>
<html>
<body>

<h1>My first PHP page</h1>

<?php
 echo "Hello World!";
?>

</body>
</html> 

I am using notepad++ to run this code, I am new to php, I am running IE emulation, this code is run under html filename extension. this code outputs "My first PHP page" but it does not output "Hello World!", I am unsure of what to do next

Advertisement
PHP is a server-side web programming technology. You don't execute it in a browser, so your editors browser emulation is likely just ignoring the PHP tags.

You will need to set up some kind of local webserver to test your PHP, probably.

should I use a PHP IDE?

Reading the other post thread, I think PHP isn't what you want. If you want to code web-based games, you should use Javascript and HTML5.

PHP is used (on a server side) to generate a "customized" webpage, using an engine, then send the "customized" webpage to the user. For example, blogs constantly generate "customized" pages: when you click on a tag, the engine will generate a page with all the posts (that might be in a database) and then send that page (containing only that information) to the user. That gives the illusion that the website is "dynamic".

Javascript, on the other hand, is a script language that will be executed in the client-side (in the user computer). It can be used to add, delete or modify the content that is already in that page in the client-side.

actually I am not working on a game, I am reading a book on dynamic web site development. I have read several chapters on PHP but I am open to learning HTML5 and Javascript, I am new to web site design. I just want to work on a simple project.

actually I am not working on a game, I am reading a book on dynamic web site development. I have read several chapters on PHP but I am open to learning HTML5 and Javascript, I am new to web site design. I just want to work on a simple project.

Ok, then you will need that PHP "engine" running. I have done it on Linux only, so I don't know which one is available on other systems or how to setup on them. Maybe this page can help with that: http://php.net/manual/en/install.windows.php

The engine will stay up running and listening to incoming requests. In this case, you go to the browser and try to access the page via localhost address. Based on that HTML with PHP code that you wrote, the PHP engine will generate the page and send to the client (the browser).

You need to pick the language/tools/tech to match whatever project you're actually trying to put together. "A dynamic website" can mean so many different things. If you've never made a website of any kind before, it would make more sense to start with plain HTML, then add Javascript once you're ok with HTML, then move onto PHP once you're comfortable with static pages and have a better idea of what your requirements are.

A good tool for local testing / dev would be something like XAMPP- it's basically a really easy way to setup a web server. Install it, hit the "start" button next to Apache, put your site in the /htdocs folder it makes, then access them by typing "localhost" into your browser. Your PHP scripts will work this way.

like ted said I am going to learn html5 and css3 and javascript first then go on to php and sql

is there any simple web site project that I can work on, I do not want to work on a game yet. I am learning html5 css3 and javascript

Usually get started tutorials create a todo list app, so that might be a good first project.

This topic is closed to new replies.

Advertisement