SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Sep 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to handel postback event in php

    Hi
    Can anybody tell me how can i handel postback event in php like in asp.net
    I want to execute soem code only when page load now when the page is
    posted back from server(when button click)?

    Thanks.

  2. #2
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Location
    edge of nowhere
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    if (!isset($_POST)) {
        
    //code here

    Unless your code requires something different.
    Programming boils down to three things: fast, good and cheap.
    Please pick two.

  3. #3
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That would be:
    PHP Code:
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
      
    // handle POST here


  4. #4
    SitePoint Member
    Join Date
    Sep 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to handel postback event in php

    Thanks to both of u for u r rply...
    yes i have done it.

  5. #5
    SitePoint Member
    Join Date
    Mar 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, I am having my own problems with redirects:

    OK let me try to make myself clear here.

    I have two parts to a website a general side and another part to the site called photography.

    Both parts to the site share the same navigation.

    For one of the links in the side navigation i have a link called FAQ's.

    Rather then have 2 different faq links shown I want to create a conditional that if your on the general side of the site go to the general faq and if your on the photography side go to the photo faq.

    so something like this i think:

    if (gen1.php, gen2.php, gen3.php)
    { go to this gen-faq.php page }

    else if (photo1.php, photo2.php)
    {go to this photo-faq.php page}

    Im not sure if this is the way I would even go around doing this. BUT COULD SOME ONE PLEASE HELP ME WITH THIS PROBLEM

    thanks


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
  •