php basics

PHP (Hypertext Preprocessor) ia an Open Source general purpose web scripting language. It is widely used for Web development because it can easily be embedded into HTML. PHP is an easy to learn and you can start developing dynamic webpages very quickly. Moreover PHP can be used in other development areas e.g Command line scripting.

<html>
  <head>
  <title>Embedding PHP in HTML</title>
  </head>
  <body>
  <?php echo “Hi, I can easily be embedded into HTML !!!”; ?>
  </body>
</html>

PHP can be used on all major operating systems, including Linux, many Unix variants (including HP-UX, Solaris and OpenBSD), Microsoft Windows, Mac OS X, RISC OS, and probably others. PHP has also support for most of the web servers today. This includes Apache, Microsoft Internet Information Server, Personal Web Server, Netscape and iPlanet servers, Oreilly Website Pro server, Caudium, Xitami, OmniHTTPd, and many others. For the majority of the servers PHP has a module, for the others supporting the CGI standard, PHP can work as a CGI processor.

Retrieving IP Address of visitors
You can see from the example above how easily PHP code can be embeded into HTML. Now let us see something more useful. We will check the IP address of the visitor of the page. This can be achieved using PHP as follows.

<html>
    <head>
        <title>IP Address of visitor</title>
    </head>
    <body>
        Your IP Address is : <?php echo $_SERVER[‘REMOTE_ADDR’]; ?>
    </body>
</html>

Working with forms
Here we will see how to use PHP in working with HTML forms. We will see how one can use PHP to access data filled in HTML forms. Let us have form with Name and Phone Number fields as below.

<form action=”action.php” method=”post”>
 Name: <input type=”text” name=”name”>
 Phome: <input type=”text” name=”phone”>
 <input type=”Submit” value=”Submit”>
</form>

Now we will see how values of these fields can be accessed using PHP.

Name: <?php echo $_POST[‘name’]; ?>
Phone: <?php echo $_POST[‘phone’]; ?>

18 Responses to php basics

  1. […] cookie values at server. At server in PHP script, cookies sent from the client browser will be turned into PHP variables. After PHP 4.1.0 the global […]

  2. Aru P1 says:

    Good site,Thank you regarding this excellent posting – I will certainly be certain to look at your weblog more frequently.Just subscribed to your RSS feed…

  3. […] cookie values at server. At server in PHP script, cookies sent from the client browser will be turned into PHP variables. After PHP 4.1.0 the global […]

  4. I really like looking through a post that can make people think.
    Also, many thanks for permitting me to comment!

  5. Hello There. I discovered your blog the usage of msn.
    That is a really smartly written article. I will be sure to bookmark it
    and come back to read extra of your helpful information.
    Thanks for the post. I will certainly return.

  6. I am not certain the place you are getting your information,
    however good topic. I needs to spend some time studying much more or understanding more.
    Thank you for excellent info I used to be searching for this information
    for my mission.

  7. éléphants says:

    Hey there, my name is Sang and I’m a fellow blogger out of Countegany, Australia. I’m glad to see the work you’re doing on this site. Coming upon wordpress.com was refreshing and helpful in terms of writing and work. Keep up the good work guys: I’ve put you guys on my blogroll. I’m sure it will increase the appeal of my own
    blog.

  8. I know this if off topic but I’m looking into starting my own blog and was wondering what all is required to get setup? I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very internet smart so I’m not 100% sure. Any tips or advice would
    be greatly appreciated. Thanks

  9. Click Here says:

    Hi there, yeah this piece of writing is actually good and I have
    learned lot of things from it regarding blogging.
    thanks.

  10. We stumbled over here coming from a different web address and thought I
    might as well check things out. I like what I see so now i am following you.
    Look forward to finding out about your web page again.

  11. I know this website provides quality depending posts and
    other information, is there any other site which offers these information in quality?

  12. If you would like to get a good deal from
    this post then you have to apply such methods to your won web site.

  13. Karolyn says:

    Сo najważniejsze polеcam go graczą ,któгzy mają różne problеmy ze swoim steamem (po ɑktuaⅼizacji) a chcieli by ⲣograć sobie
    przү leprᴢej jakosci obrazu.

  14. Tilly says:

    Superb blog you have here but I was wanting to know if you knew
    of any message boards that cover the same topics discussed here?
    I’d really like to be a part of community where I can get advice from other knowledgeable individuals that share the same interest.
    If you have any recommendations, please let me know. Many thanks!

  15. After going over a few of the articles on your web site, I truly like your
    way of writing a blog. I book marked it to my bookmark site list and will be checking back in the near
    future. Please check out my website as well and let me know how you feel.

  16. sex says:

    First of all I want to say excellent blog! I had a quick question that I’d like to ask if you do not
    mind. I was interested to know how you center yourself and clear your thoughts before
    writing. I’ve had a difficult time clearing my thoughts in getting my thoughts out there.
    I truly do take pleasure in writing however it just seems like the first 10 to 15 minutes
    tend to be wasted just trying to figure out how to begin. Any ideas or hints?
    Appreciate it!

  17. bursa lagu says:

    Hi everyone, it’s my first pay a visit at this web page, and piece of
    writing is actually fruitful in support of me, keep up posting these articles or reviews.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: