Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Senior Member Tyler Smith's Avatar
    Join Date
    Oct 2011
    Posts
    115
    Member #
    29767
    Liked
    7 times
    Hello all,

    This is a question about a PHP script for collecting e-mails in my submission box at my website that I'd like help in writing myself in order to do the following:

    1. Check the submission to see if it is, in fact, at a web address with an @ in the submission.
    If it contains an e-mail address, send a test e-mail and see if the e-mail address is valid.
    If it sends successfully, do the following:
    Display screen with "Check here if you would like to be added to..."
    When that is selected and the user clicks okay, do this:
    Send an e-mail to 2 e-mail addresses for me
    Write user to mySQL database on server.


    To start, this is what is there for the form on the home page:
    HTML Code:
    <form id="emailbox" name="form1" method="post" action="email.php">
          <div>
              <input type="text" name="go" id="go" value="your e-mail" onclick="input_focus(this)" onblur="input_reset(this)"/>
              <input type="submit" value="Join" />
          </div>
    </form>
    I was having trouble finding a good predefined method in the php.net directories for strings to test if there is a .com, .net, .biz, .org, .info, etc. & if there is an @ in the submission- do you know of one?

    I would also like to limit the number of characters in a valid submission. Let me liberal, say, a maximum of 60 characters. Would that be done in JavaScript or something besides PHP?

    I would be using a global variable, $email, which would be initialized through $_POST["go"], as you can see in the form markup. Then I can make a function, isItAValidEmail(), for the submission testing, then a second function for test e-mail and e-mail list joining acceptance is displayed using the echo(**some HTML & their styles**) function.


    Thanks for the suggestions.
    I'd like to do this on my own and build some experience with PHP instead of just use some service.

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    So you're describing a system where they enter their email and you determine if it's OK without them confirming the email?

    Normally, you send a confirmation to their email and they have to open the email and reply back. That verifies that their email is correct and that it is working.

    Which system are you actually describing?

    Maybe your definition of 'global' is different than what I'm thinking?
    $_POST variables are not global.

    The "global variable" part does not exist. You never use global variables. Instead, if you determine the user is 'valid' (however you decide that), you set a PHP SESSION variable that follows them around your site until they close their browser. Sort of like a temporary cookie that resides on the server.

    You can check that SESSION any time you wish .... determining what to do if they are valid.
    Even knowing if the SESSION is 'set' may be all you need to know.



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:35 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com