SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    How to handle Yes/No on webpage...

    I am adding a feature on my website for Members to add (other Members as) "Friends".

    The way I envision it working, is the person would click on the "Request Friendship" link in that person's Member Profile, and then be taken to a confirmation page which asks...

    You have requested DoubleDee to be your friend.

    Would you still like to send this request?

    ------------------------ -----------
    | Request Friendship | | Cancel |
    ------------------------ -----------
    If the person clicks on the "Request Friendship" then I need to fire off a whole bunch of PHP behind this page to do things like...

    - INSERT record in Friends table
    - EMAIL person

    and so on...


    I am wondering if I should handle all of this behind an HTML Form, or if there is some way to put "Command Buttons" on a web page and have them trigger actions behind-the-scenes?!

    Hope that makes sense?!

    Thanks,


    Debbie

  2. #2
    SitePoint Guru bronze trophy TheRaptor's Avatar
    Join Date
    Jul 2011
    Location
    New York
    Posts
    710
    Mentioned
    40 Post(s)
    Tagged
    0 Thread(s)
    Maybe I don't understand the question properly but why not execute all the code required to actually send the request when the user clicks the "Request Friendship" button?
    TheRaptor - Joe

  3. #3
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by TheRaptor View Post
    Maybe I don't understand the question properly but why not execute all the code required to actually send the request when the user clicks the "Request Friendship" button?
    You're asking a question of my question?!

    I am asking if you can have BUTTONS that do stuff (e.g. execute code) on a Web Page that is NOT a Web Form...

    In the past I have always had a Form that was "submitted" and when that happened, then I execute PHP code.

    In a way, my example could be construed as a Form because it has a "submit" type button on it. (It just doesn't have a bunch of Form Fields like you'd usually see.)


    Debbie

  4. #4
    SitePoint Guru bronze trophy TheRaptor's Avatar
    Join Date
    Jul 2011
    Location
    New York
    Posts
    710
    Mentioned
    40 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    I am asking if you can have BUTTONS that do stuff (e.g. execute code) on a Web Page that is NOT a Web Form...
    Thats what I thought you were asking. The answer to that question is yes but it can be tricky.
    TheRaptor - Joe

  5. #5
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by TheRaptor View Post
    Thats what I thought you were asking. The answer to that question is yes but it can be tricky.
    So it sounds like I should use a Form instead...


    Debbie

  6. #6
    SitePoint Guru bronze trophy TheRaptor's Avatar
    Join Date
    Jul 2011
    Location
    New York
    Posts
    710
    Mentioned
    40 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    So it sounds like I should use a Form instead...
    Yes, that would be a bit easier to set up.
    TheRaptor - Joe


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
  •