Beginning PHP: One Goal at a Time
A couple of months ago, I knew almost nothing about PHP, only that is was a programming language that I needed to learn. Today, my whole site relies upon PHP and I have gained the confidence that almost anything is possible using PHP. I accomplished this achievement using methods that I will describe in this article.
Set Small Goals That You Can Achieve
One of the most destructive things a programmer can do is to try to develop an extensive program or complicated website all at once. When I started to create my new site, I began with a simple goal--to make a members' area that users could log into and out from. I didn't decide what features the members area would have, I just wanted to successfully code the restricted area. I made a very simple form of registration--a database for users and the PHP functions that were required to transfer the data to the MySQL database. It was not a 'mission impossible' goal, but it was something that I knew I could accomplish and then I could move on to the next goal.
At this point I decide how to ensure that it is entered by the user in the form of data. Keep in mind that hackers may try to confuse or misuse of automatic registration database filled with junk e-mail me, I decided to do a simple security key to use the image. Users need to enter the text from the image in order to prevent spam / robot registration.
My next task was to decide how people can login and logout and how to validate the form to make sure someone did not enter garbage data in the email field. Then I needed to figure out how to send an email when the user finished the registration process. This was needed in order to make sure that the user entered a valid email.
After I worked out the features mentioned above, I started to think about my next task. I decided to allow members to post their own tutorials on the site and store them in the MySQL database. I wanted to be able to:
- rate these tutorials
- create a profile for each user
- allow users to comment on several pages
- allow users to search through these areas
- integrate the JavaScript with the PHP code
Using PHP with JavaScript code, and dynamic content, I do, JavaScript in the pull-down menu is provided to allow me to insert the title of the new tutorial. I generally like AJAX I need to be reloaded if the user's rating page for my assessment that no
The Internet Is a PHP Developer's Friend
Even if you do not have any PHP manuals or books, if you read this article, you are very lucky! Internet search engines, forums and PHP is located in www.php.net manual can be your best tool. First of all, I have the syntax of any PHP function, or implementation of methods, appears to be in the PHP manual above website. Then, I try to own PHP code, if I have not found what I needed, or I face a problem, I use a search engine or forums to find answers to my questions.
Keep in mind that by searching the discussion forums, I have also found some very complicated solutions to problems that I was able to solve in a much simpler manner. Nevertheless, the forum posts can provide you with an idea of what is going on with your code, or what you need to do to accomplish your goal.
On the problems faced, I think that one spent a lot of time, when I for my site security. An example is the mysterious PHP to run twice, so this is as a user's image display, from the actual key sent to the PHP form processing page a different key. This problem only occurs in the Mozilla browser. I do not know the first two runs PHP is that I do not doubt this is related to the browser, I found online and found that from the guys said something similar problems in the forum post. They explained that, Mozilla's request, HTML and images to use a separate request. Using this information, I can come up with effective solutions package.
Everything You Want, You Must Code
When you do not want to use other developer's code, you can certainly learn from their work. If you use other programmer jobs depend only re-learn your tricks, you can say so. For example, if I, as a mechanism to create my tutorial submission tool, open source forum, I would have ended, and did not know how stored in the form of the textarea's caret.
Hack Your Own Site
Security issues are very important for any developer, even for the most rudamentary applications. For instance, you do not want to wake up one morning to find your site's guestbook full of junk and porn advertisements.
If any one application may not work correctly, your site was flawed. The best thing about PHP is one, it is a server-side language, which means that users will not see the code directly - things behind the scenes. On the contrary, if you write bad code, you may be inevitable that allow users to really mess things your site has. For example, you will not want to allow the transfer of variables through form input directly to your database. You should use htmlspecialchars to prevent malicious code to let others add to the database.
Interactive Site?
These days, the topic, the website adopt a flexible attitude, with their guests. The best way to create some interaction is mixed JavaScript and PHP, so that these "teammates" to work together. The most promising new technologies is one of AJAX, which it. I recently started using my website on the AJAX. This is a simple, fast, saves you from waiting for user page refresh just post a comment again, for me, (or the rate of tutorial). Because PHP is a server-side language, you only need to reload the page to pass variable. Ajax using XMLHttpRequest or other means of JavaScript, but you can achieve in the background server and without having to reload any results returned to the user.
Conclusion
Although I am still learning PHP, by using the techniques I mentioned above, I was able to create my own interactive website. I continue to add to my site, and my knowledge of PHP increases with each new feature I add. I encourage you to begin your own journey into PHP programming--you won't be sorry.