SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Feedback form

  1. #1
    Web Enthusiast
    Join Date
    Jul 2000
    Location
    Western Massachusetts, USA
    Posts
    1,381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Feedback form

    I want my website visitors to sign up for email and fill out a needs assessment, both of which are forms that generate an email to me.

    The email sign-up form is at
    http://carterzoo.com/kidbuiltpc/simple_form.html
    and the code works well.

    [PHP]<?

    if (($sender_name == "") && ($sender_email == "")) {
    header("Location: http://carterzoo.com/kidbuiltpc/simple_form.html");
    exit;
    }

    $msg = "E-MAIL SUBSCRIPTION SENT FROM www.carterzoo.com/kidbuiltpc\n";
    $msg .= "Sender's Name: $sender_name\n";
    $msg .= "Sender's E-Mail: $sender_email\n\n";


    $to = "paulc@carterzoo.com";
    $subject = "Email subscription";
    $mailheaders = "From: carterzoo.com/kidbuiltpc/email_sub <> \n";
    $mailheaders .= "Reply-To: $sender_email\n\n";

    mail($to, $subject, $msg, $mailheaders);

    ?>

    The form elements and the code "if" and "$msg" variables for this page have only a "name" attribute.

    However the needs assessment at http://carterzoo.com/kidbuiltpc/needs.html has check boxes, which have both "name" and "value" attributes. How do I modiyfy the code to include both?
    Paul C.
    ClickBasics
    http://www.clickbasics.com

  2. #2
    :) delemtri's Avatar
    Join Date
    Jun 2001
    Posts
    579
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do you mean?

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So let me get this right, first you have a page where you have to fill in your name and emailadress, and on the next page you have to fill in some other things.

    Then you just have to do

    $hiddenname = $name;

    and put this next line in the <FORM>
    <input type=hidden name=name value=$hiddenname>

    Is this what you mean, if not, try explaining again...

    or maybe this anwsers your question,

    at a checkbox, name = the name of the checkbox.
    just like @ <input type=text name=yourname value='enter your name here'> and value is, if checked 1, if not checked 0.

  4. #4
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    try this code for checkboxes it checks whether you have selected it first and then either gives you a Y or a N:

    //repeat for the number of checkboxes to check if have been clicked?
    $str_sarah = ( isset($sarah1) ? 'Y' : 'N');
    $str_sarah = $str_sarah. ( isset($sarah2) ? 'Y' : 'N');

    where my checkboxes look like this:

    test1INPUT TYPE="checkbox" NAME="sarah1" VALUE="name">
    test2INPUT TYPE="checkbox" NAME="sarah2" VALUE="name">
    test3INPUT TYPE="checkbox" NAME="test1" VALUE="name">
    test4INPUT TYPE="checkbox" NAME="test2" VALUE="name"></TD>

    also the checkbox VALUE doesn't come into it they could be zero

    not sure if this helps at all?

    Sarah

  5. #5
    Web Enthusiast
    Join Date
    Jul 2000
    Location
    Western Massachusetts, USA
    Posts
    1,381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks for your help

    Thanks all. I found a great program called form sender at creativephp.com/php/Downloads/php002/php002.php3.

    It works great!
    Paul C.
    ClickBasics
    http://www.clickbasics.com


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
  •