SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Dec 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help - small project, simple PHP

    Hi all,

    let me preface this by saying i have never written a php code in my life, but i do have minimal experience with javascript so programming isn't completely foreign for me.



    Im using Dreamweaver CS3 and i want a code that does the following:

    I have 2 text boxes, one called 'name', the other 'link', when I input both these values in i want 'name' to appear on my page and it to be hyperlinked to 'link'.

    I also want the date they were added to appear next to them.

    And if possible, i would like them to only stay on my page for X number of days.

    I know this is probably very simple, so if someone could point me to an easy tutorial or a simple way to do it, I would be very grateful.

    Thanks

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    You'll need a database as well (MySQL) to store the links.
    Why don't you do a google search. 'simple php mysql' for example gives lots of results.

  3. #3
    SitePoint Member
    Join Date
    Dec 2008
    Location
    Saigon, Vietnam
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Because you've known javascript, I think you're familiar with html, so creating web pages and forms is not a problem for you. The steps you need to do for your requirements above is something like:
    1-Create an HTML form with 2 text boxes: name and link. The "action" attribute of the form points to your PHP script. (You've already known how to do this)
    2-In your PHP file, you need to extract value from form fields and store it somewhere (for example, in a database table). To do this, you need to learn how to get form field values in PHP, how to store data in a database or a file (to store data in a database, you may need to learn SQL too). When storing your data, remember to store the current time.
    3-On another PHP file, you need to extract data from your storage location (name, link, date). If you know how to do step 2 above, I think you know enough for this step too. Remember to delete records that is older than X days. With needed data, what you need to do now is just show them. Your HTML knowledge will help.

    Hope that helps.

  4. #4
    SitePoint Member
    Join Date
    Dec 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks guys.

    I have been trying to get my head around this all day, and i think creating the database will be my biggest problem. I'll do some googling tomorrow (its night here) as guido suggested to try and figure out the database bit


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
  •