Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder Kevin_M_Schafer's Avatar
    Join Date
    Apr 2011
    Location
    Fairfax, Minnesota, U.S.A.
    Posts
    482
    Thanks
    97
    Thanked 17 Times in 17 Posts

    Wanting to eliminate the e-mail field from form

    I'm working on a news tip line feedback form and I would like to remove the e-mail field. I don't need an e-mail field at all.

    It doesn't matter with the other fields -- they can come and go, but for some reason the e-mail field affects the operation of the form if it's removed. I've used this setup on my new site several times just by tweaking it. In all those instances, I've always needed an e-mail field.

    Any help in removing the e-mail field would be greatly appreciated.

    PHP Code:
    <?php 
    /* 
    This is the e-mail address you want to send to. 
    */ 
    $webmaster_email "My_Mail"

    /* 
    These are the URLs of supporting pages. 
    */ 
    $feedback_page "feedback_form.html"
    $error_page "error_message.html"
    $thankyou_page "thank_you.html"

    /* 
    This loads the form field data into variables; 
    add additional fields here. 
    */ 
    $comments $_REQUEST['comments'] ; 
    $name $_REQUEST['name'] ; 
    $phone $_REQUEST['phone'] ; 
    $email_address $_REQUEST['email_address'] ; 
    /* 
    This checks for e-mail injection and carriage return 
    used by spammers to inject CC list. 
    */ 
    function isInjected($str) { 
        
    $injections = array('(\n+)'
        
    '(\r+)'
        
    '(\t+)'
        
    '(%0A+)'
        
    '(%0D+)'
        
    '(%08+)'
        
    '(%09+)' 
        
    ); 
        
    $inject join('|'$injections); 
        
    $inject "/$inject/i"
        if(
    preg_match($inject,$str)) { 
            return 
    true
        } 
        else { 
            return 
    false
        } 


    $body 
    'Name: ' $name .
    PHP_EOL 
    'E-mail: ' $email_address .
    PHP_EOL 
    'Phone: ' $phone 
    PHP_EOL 
    'Comments: ' $comments;  


    // If user tries to access php script directly, redirect to the comment form. 
    if (!isset($_REQUEST['email_address'])) { 
    header"Location: $feedback_page" ); 


    // If any fields in form are empty, redirect to the error page. 
    elseif (empty($comments) || empty($name) || empty($phone) || empty($email_address)) { 
    header"Location: $error_page" ); 


    // If email injection is detected, go to error page. 
    elseif ( isInjected($email_address) ) { 
    header"Location: $error_page" ); 


    // Send email then redirect to the thank you page if all things met. 
    else { 
    mail"$webmaster_email""Feedback Form Results"
      
    $body"From: $email_address" ); 
    header"Location: $thankyou_page" ); 

    ?>

    --Kevin

    .
    Last edited by Kevin_M_Schafer; 02-20-2012 at 10:21 PM. Reason: text clarity
    My keyboard is an IBM from 1993 and I like it that way. | Who is Dan Well? Everyone always says I know Dan Well.Building a web page is like building a birdhouse. Put it up there and watch 'em come. | Maintaining the aspect ratio of an image is more important than having a cold orange pop.

  • #2
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,559
    Thanks
    76
    Thanked 105 Times in 104 Posts
    Do you want it to send an email, just post the message, or allow it even if they don't put in their email?
    Been a sign maker for 7 years. My business:
    American Made Signs

  • #3
    Regular Coder Kevin_M_Schafer's Avatar
    Join Date
    Apr 2011
    Location
    Fairfax, Minnesota, U.S.A.
    Posts
    482
    Thanks
    97
    Thanked 17 Times in 17 Posts
    Hello myfayt,

    Thank you for the reply. I would like to take the e-mail field completely out of my form, so that no identity is required. I would like only the Comments to be submitted, with Name being an option.

    I've been successful changing around the form for other uses, but "email_address" appears in a lot of different areas on the php form and I don't understand why.

    Here is a link to my page where I want to use only the Comments and Name fields.

    http://www.theeagleextra.com/tee/nav/snt.shtml

    The e-mail portion of the php should completely go away. Then I can take it out of my html.

    Thank you for taking a look. I appreciate it.

    --Kevin

    .
    My keyboard is an IBM from 1993 and I like it that way. | Who is Dan Well? Everyone always says I know Dan Well.Building a web page is like building a birdhouse. Put it up there and watch 'em come. | Maintaining the aspect ratio of an image is more important than having a cold orange pop.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •