SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict lundberg's Avatar
    Join Date
    Mar 2003
    Location
    Sweden
    Posts
    370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to use $_GET in the right way?

    Hello,

    I have 1 page to both, Add, remove and edit posts in a table. Now I have this:

    PHP Code:
    if ($_GET['action'] = 'write') {
        
    Show the add post form.

    and then later on.

    PHP Code:
    if ($_GET['action'] = 'edit') {
        
    Show the edit post form.

    And the link i have are thefile.php?action=write and thefile.php?action=edit

    BUT! When I clik on the thefile.php?action=edit link then the code that is in the if ($_GET['action'] = 'write') { } is shown!?

    I have to do something wrong. =(

    Martin Lundberg
    Sweden

  2. #2
    + platinum's Avatar
    Join Date
    Jun 2001
    Location
    Adelaide, Australia
    Posts
    6,441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You'll need to use the comparison operator which is == rather than =

  3. #3
    SitePoint Addict lundberg's Avatar
    Join Date
    Mar 2003
    Location
    Sweden
    Posts
    370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah stupid me, i knew that =P Thanks, everything works now!

    Martin Lundberg
    Sweden


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
  •