SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Addict psychedelic's Avatar
    Join Date
    Feb 2002
    Location
    Boston
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    buttons and check boxes with php/mysql

    How do you work with buttons and php/mysql?

    for the moment, i'm just interested in the php part.

    Right now I have this form which sends and email to someone regarding pre registration for an event. There are three events and I have a check box for each. Now how do I get this information into the php to put in an email?
    The Internet is prettier on a Mac.

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2002
    Location
    Kentucky, USA
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try
    PHP Code:
    if(IsSet($checkbox)) {
         
    Its true


  3. #3
    SitePoint Addict psychedelic's Avatar
    Join Date
    Feb 2002
    Location
    Boston
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but that are 3 checkboxes.

    are you saying that they're bools?

    say i have three checkboxes, which i've named:

    event1, event2, and event3.

    Now what about radio buttons?
    The Internet is prettier on a Mac.

  4. #4
    SitePoint Addict psychedelic's Avatar
    Join Date
    Feb 2002
    Location
    Boston
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    never mind, i'll go get a book instead....
    The Internet is prettier on a Mac.

  5. #5
    SitePoint Addict zoordaan's Avatar
    Join Date
    Feb 2001
    Location
    NYC/Texas
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, killer2239 isn't saying the checkboxes are booleans. The isset function checks to see if event1, event2 or event3 has a value. If it does have a value then it would return true. And you would then do something based on it being true.

    But I think the first thing you need to figure out is how to use forms with php. There are several tutorials online that explain how to do this (I have one on my website), you should do a search in a search engine, and see which one you understand best.

  6. #6
    SitePoint Addict psychedelic's Avatar
    Join Date
    Feb 2002
    Location
    Boston
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i know how to use forms with php, it's just that i use text fields and hidden fields all the time. his explanation is lacking. i got a book instead. better than waiting here ... i'm new, but don't assume i don't know...
    The Internet is prettier on a Mac.

  7. #7
    SitePoint Addict zoordaan's Avatar
    Join Date
    Feb 2001
    Location
    NYC/Texas
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I thought you didn't know because of this
    Now how do I get this information into the php to put in an email?
    I have several php books and I think having a book is a good idea.

    Anyway in regards to composing the email with the values of your form variables, you can do something similar to this:

    Code:
    <?php
    if (isset($btnSendEmail)){
    
    $strSubject= "Website.com: Advertising Questionaire";
    $strSender =$email;
    $strBody .="Organization/Company: $organization\n";
    $strBody .="Address: $address\n     $city, $state, $country\n";
    $strBody .="Phone number: $phone\n";
    $strBody .="Website: $web\n";
    $strBody .="Description: $question\n";
    
    $strHeader = "Return-Path: $strSender\nErrors-To: $strSender\nFrom:$name<$strSender>";
    
    
           mail("you@website.com",$strSubject,$strBody,$strHeader);
    
    }
    
    ?>

  8. #8
    SitePoint Addict psychedelic's Avatar
    Join Date
    Feb 2002
    Location
    Boston
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nooo.... i already have that part. hehe. i must not be explaining myself well... sorry! ...

    the form i'm working with was done, but the client wanted me to add some stuff. there are 3 events, and the form allows the user to preregister for auctions. before, there was only 1 auction, so that was easy. now there's 3 auctions. so i made checkboxes. what i don't know how to do is get the stuff from teh check boxes.

    in the html, i named them event1, event2, event3.

    so i'm assuming...
    PHP Code:
    if(IsSet($event1)) {
         
    $email .= "Auction 1 registed";
    }
    if(IsSet(
    $event2)) {
         
    $email .= "Auction 2 registed";
    }
    if(IsSet(
    $event3)) {
         
    $email .= "Auction 3 registed";

    But i still don't know how to do radio buttons. i have the php bible which i dug out, but i can't find it in there. it has like text forms and stuff.

    i'll try again this weekend when i have more time and am more awake. thanks for your effort
    The Internet is prettier on a Mac.


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
  •