what is a php script

Sharky Forums


Results 1 to 2 of 2

Thread: what is a php script

  1. #1
    Expensive Sushi
    Join Date
    Nov 2000
    Location
    houston, texas, usa
    Posts
    22

    Post what is a php script

    hmm anyone know

  2. #2
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    PHP is a scripting language. It's used in conjunction with standard HTML to give it some really powerful functionality.

    Basically, all you do is rename an HTML file to have a .php3 extension (or whatever extension the webserver is configured for), and then you can insert PHP scripting into the document.
    You begin all PHP code with "<?" and end with ?>"

    Here's an example:
    <area shape="rect" coords="0,0,49,124" href="<? print "index2.php3?i="; ?>1">

    This is a section of an imagemap code, same as any HTML, but where you see the "<?" and "?>", between there is PHP code.
    It says:
    print $PHP_SELF."?i=";

    If you're familiar with any kind of programming, this shouldn't be too hard to recognize what's going on here.

    It's a simple line of code, which is using a built in function called "print", which writes what it's told onto the document.
    What is it being told to write?
    $PHP_SELF."?i=";
    $PHP_SELF is a variable which is always assigned the current address of the document (itself).

    And what's beween the quotes "?i=", is how you tell the print function to write exactly what you write.

    And as in most any programming / scripting language, you end that line with a semi-colon;

    In the end, this line of code will spell out a link for:
    <area shape="rect" coords="410,1,482,11" href="index.php3?i=6">

    This doesn't serve much more purpose than having dynamic links, which will always work nomatter what you rename that webpage file. there's a billion other things you can do with PHP. You can make messageboards, order forms, pretty much anything you can imagine that would serve some sort of functionality on the web.

    Pick up a book sometime if you're interested. It's a must to know if you're seriously interested in Webdesign.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •