SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Addict
    Join Date
    May 2007
    Location
    West Coast
    Posts
    336
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Email Send Filter question

    I am stuck on this filter working

    Code:
    if($_POST['State']=="FL" AND ['Amount']=="400000+")
        {
    	$cc_tomail[0]="";
        }
    I tired the above but it does not work. I can get it to work alone with the state.

    I want the formmail to filter this and send to a specific email.

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    4,812
    Mentioned
    141 Post(s)
    Tagged
    0 Thread(s)
    You forgot $_POST infront of ['Amount']
    Be sure to congratulate xMog on earning April's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  3. #3
    SitePoint Addict
    Join Date
    May 2007
    Location
    West Coast
    Posts
    336
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks I see that and corrected it but it still does not filter properly.
    It still comes through if it is 200000 or 400000.
    I also tried to use use >400000

  4. #4
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    4,812
    Mentioned
    141 Post(s)
    Tagged
    0 Thread(s)
    put var_dump($_POST); above your IF statement and post the output it produces for both of those options.
    Be sure to congratulate xMog on earning April's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  5. #5
    SitePoint Addict
    Join Date
    May 2007
    Location
    West Coast
    Posts
    336
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That gave me an error msg and still went through.

  6. #6
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,079
    Mentioned
    53 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lukkas View Post
    That gave me an error msg and still went through.
    Lukkas,

    Try to be as as detailed as possible when mentioning "errors". Without supplying the error message and new source code used, in any case when trying to get help, stops us from moving forward in our attempts to help out.

  7. #7
    SitePoint Addict
    Join Date
    May 2007
    Location
    West Coast
    Posts
    336
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    from a php formmail script trying to filter with numbers
    Code:
    // recipient info
    	$charset[0]="UTF-8";
    	$tomail[0]="example@yahoo.com";
            var_dump($_POST);
    	if($_POST['State']=="Texas" OR $_POST['State']=="Illinois" AND  $_POST['Amt'] >"417000"){
    	$cc_tomail[0]="";
    	$bcc_tomail[0]="test@yahoo.com";
    	}
    I get this warning:
    Warning: Cannot modify header information - headers already sent by (output started at /home/public_html/site.com/submit/mail.php:21) in /home/public_html/site.com/submit/mail.php on line 575


    that particular line in the mail.php is: header("Location: ".$thanks_page[$config]);

    hope that helps

    Thanks

  8. #8
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,079
    Mentioned
    53 Post(s)
    Tagged
    0 Thread(s)
    Okay. What that error means is that you have already outputted data to the screen, so it cant send a header (one was already created). You dont want to forward from that page at the moment anyway because you want to be able to read the var_dump that is produced. so lets run this code:

    Code PHP:
    // recipient info
        $charset[0]="UTF-8";
        $tomail[0]="example@yahoo.com";
            var_dump($_POST);exit; //added exit
        if($_POST['State']=="Texas" OR $_POST['State']=="Illinois" AND  $_POST['Amt'] >"417000"){
        $cc_tomail[0]="";
        $bcc_tomail[0]="test@yahoo.com";
        }

    the program will exit before anythign else, allowing you to see the var dump

  9. #9
    SitePoint Addict
    Join Date
    May 2007
    Location
    West Coast
    Posts
    336
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, it allows me to see a var dump. now the thank you page does not show only the dumped fields when submitting. No email is received either

  10. #10
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    4,812
    Mentioned
    141 Post(s)
    Tagged
    0 Thread(s)
    Copy and paste the output from the var_dump here for us to see. We need to see the data it is spitting out.
    Be sure to congratulate xMog on earning April's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  11. #11
    SitePoint Addict
    Join Date
    May 2007
    Location
    West Coast
    Posts
    336
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it is a form-mail script with many fields and it is spitting all those out when click submit.
    Not really what I was looking for. I just wanted a filter based on numbers input in a field.
    I don't understand what relationship it has filtering

  12. #12
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    4,812
    Mentioned
    141 Post(s)
    Tagged
    0 Thread(s)
    Okay, we need to see that information to be able to help you. Unless I see what is being stored in ['Amount'], I can't fix your code. I want you to copy and paste what it writes to the screen in a response here so I can see how to fix your code.
    Be sure to congratulate xMog on earning April's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes


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
  •