1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Coding help

Discussion in 'Web Design' started by fotbal5, Apr 7, 2010.

  1. fotbal5

    fotbal5 Registered Member

    Joined:
    Mar 29, 2010
    Messages:
    58
    Likes Received:
    1
    HI, I need help figuring out how to setup a new site. Basically what I dont know how to do is make it so that when a person submits their email to my they get an automatic email from me giving them a random number between 1000-1000000000

    Now I don't understand how I would go about setting it up and what software to use, or what code. The coding must email them a different number each time.

    Is there free software I could use, or is there a simple code?
     
  2. yeahright

    yeahright Registered Member

    Joined:
    Jan 17, 2009
    Messages:
    93
    Likes Received:
    32
    That's simple code and can be achieved using the php mail function and mt_rand. Google them.
     
  3. radi2k

    radi2k Junior Member

    Joined:
    Nov 29, 2009
    Messages:
    117
    Likes Received:
    34
    Location:
    Germany
    isnt that something like an opt-in form? in that case you could also use other pages to verify them automated. you can do this with aweber or others.

    hope that helps :)
     
  4. fotbal5

    fotbal5 Registered Member

    Joined:
    Mar 29, 2010
    Messages:
    58
    Likes Received:
    1
    Are these free ways to do this. I dont really wana spend money on the email responder part.
     
  5. kaidoristm

    kaidoristm BANNED BANNED

    Joined:
    Feb 13, 2009
    Messages:
    564
    Likes Received:
    727
    PHP:
    $number date("YmdHis".substr(microtime(),2,6));

        
    $to "[email protected]";
        
    $subject "Here's your number take it now";
        
    $headers .= "To: [email protected]"\r\n";
        
    $headers .= "From: [email protected]"\r\n";
        
    $headers .= "Reply-To: [email protected]"\r\n";
        
    $headers .= "Subject: $subject"\r\n";
        
    $headers .= 'X-Mailer:PHP/' phpversion() . "\r\n";

        
    $message "Ok here's your sneaky number: $number";
        
    $message wordwrap($message70);

        
    mail($to,$subject,$message,$headers);

     
    Last edited: Apr 7, 2010
  6. fotbal5

    fotbal5 Registered Member

    Joined:
    Mar 29, 2010
    Messages:
    58
    Likes Received:
    1
    so how exactly should i go about setting it up. Basically the person will fill out a cpa offer and then be allowed to enter their email on my page to win a free Ipod. When they enter the email I want to automatically send them a random number, so they think that they've actually been put in the drawing to win. So how would i set it up so when they entered their email, the site would send them an email with any random number
     
  7. kaidoristm

    kaidoristm BANNED BANNED

    Joined:
    Feb 13, 2009
    Messages:
    564
    Likes Received:
    727
    Bit more complete. Quick and nasty but works

    PHP:
    <?php

    echo '<form method="post" action="" >
    E-mail:<input type="text" name="email" value="" />
    <input type="submit" name="submit" value="Submit" />
    </form>'
    ;

    if(
    trim($_POST['submit'] == Submit))
    {
        if(!
    filter_var(trim($_POST['email']), FILTER_VALIDATE_EMAIL))
        {
            echo 
    "E-mail is not valid";
        }

        else
        {
            
    $number date("YmdHis".substr(microtime(),2,6));

            
    $to trim($_POST['email']);
            
    $subject "Here's your number take it now";
            
    $headers .= "To: ".trim($_POST['email']) . "\r\n";
            
    $headers .= "From: [email protected]"\r\n";
            
    $headers .= "Reply-To: [email protected]"\r\n";
            
    $headers .= "Subject: $subject"\r\n";
            
    $headers .= "X-Mailer:PHP/" phpversion() . "\r\n";

            
    $message "Ok here's your sneaky number: $number";
            
    $message wordwrap($message70);

            
    mail($to,$subject,$message,$headers) or die("Sorry but sending an email failed"); 
        }

    }

    ?>
     
    Last edited: Apr 8, 2010
  8. fotbal5

    fotbal5 Registered Member

    Joined:
    Mar 29, 2010
    Messages:
    58
    Likes Received:
    1
    so, how would i would just put this php into the site?
     
  9. cbar126

    cbar126 Junior Member

    Joined:
    Nov 10, 2009
    Messages:
    167
    Likes Received:
    65
    create a .html page and input the code between <? and ?> or create a .php and input the code as is.

    I just tested this code and works fine :)
     
  10. fotbal5

    fotbal5 Registered Member

    Joined:
    Mar 29, 2010
    Messages:
    58
    Likes Received:
    1
    How did you test it. I uploaded it to a website as a .php and then it had the submit button, but it didnt work. Also there was code on the bottom of the page.
     
  11. kaidoristm

    kaidoristm BANNED BANNED

    Joined:
    Feb 13, 2009
    Messages:
    564
    Likes Received:
    727
    Ok here's an simple explanation how to use it. Change the text Here's your number take it now to your desired text it will be the subject of the email.
    Change the text Ok here's your sneaky number: To your desired text it will be the content of the email. Change the email [email protected] to your desired email it will me the email which shows up from who the email came.
    Now leave rest of the code exactly like it is.
    Now copy and paste that code into your website or page and save it with extension .php . That's it It works as expected se3nds the number to entered email.
    So the reason why you saw the code on bottom of your page is that the code didnt have php brackets there is now so try again.