SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2007
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Variables and php

    Hi

    I have just started to learn PHP. I am wanting to make my present website into an all PHP website. I have learnt a bit about the basics and feel confident enough to actually embark on the task yet still do not really known what I am am doing. My site is just a photography site and the only content is pictures. Each page is literally a picture and some general links.

    I have learnt some basic techniques about creating html content dynamically. But the one thing I want to do is pass a variable to the php file I am calling. Basically I want to pass a parameter to a new page(or maybe a series of parameters).

    I do not want to link to a PHP file but rather call a php function within that file. How would I word a href in such a case.

    Once I can feed a parameter in I will be able to do most of what I want to do.

    Also does anyone know a very very very simple example of a database.

    One last thing. I have had my photography site going for about five weeks now and its had plenty of enough page hits. The siten gets hundreds of hits on average a day. Its just photos of surfers(the sea kind rather than computer kind) and I simply pass the site round by word of mouth. Yet I still am not on google with the site. The sites had 23,000 page hits and its really annoying me.

    http://scarboroughphotos.110mb.com/surfcity.html

  2. #2
    SitePoint Wizard wheeler's Avatar
    Join Date
    Mar 2006
    Location
    Gold Coast, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you are probably after $_GET. for example,
    Code:
    <a href="browse.php?id=434">a category</a>
    On the page browse.php
    PHP Code:
     $id = (int)$_GET['id']; // get value of id ensuring it is a number 
    Then, using $id you can do whatever you like, whether using it in a database query or taking any number of other actions based on its value. I don't know if this answers your question - there is also an option, of including files. See this blog article on server side includes: http://www.thomasmultimedia.com.au/w...-side-includes
    Studiotime - Time Management for Web Developers
    to-do's, messages, invoicing, reporting - 30 day free trial!
    Thomas Multimedia Web Development

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2007
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    many thanks. Thats the one I was looking for

    -------------
    http://scarboroughphotos.110mb.com/surfcity.html


Bookmarks

Posting Permissions

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