Html Coding. Help!

Discussion in 'HTML & Website Design' started by albag999, Oct 1, 2008.

  1. #1
    HI,
    I am creating a website and need a mailing list on there but not sure how to do it.

    Does anybody know how to create one?

    basically I want the word Join then a box next to it so that they can type in there email address.

    Anybody got any few pointers they can show me.

    Thanks for all your replies
     
    albag999, Oct 1, 2008 IP
  2. cougarxs

    cougarxs Peon

    Messages:
    662
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    hi mate, you need a form for this.. the form will send you a email or to you database & then you gather all your emails and import them into a mass mail client ready to send out your newsletter at given times / dates.
     
    cougarxs, Oct 1, 2008 IP
  3. albag999

    albag999 Active Member

    Messages:
    289
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    ok thats all well and good but how do you do this?
     
    albag999, Oct 1, 2008 IP
  4. cougarxs

    cougarxs Peon

    Messages:
    662
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i was kind enough to take the time to explain what you need to do..

    this will get you started, but i suggest you go read some basic html docs & learn about forms and how to make them.

    http://www.w3schools.com/Html/tryit.asp?filename=tryhtml_form_mail
    Code (markup):
    i got alot on my plate right now, maybe someone can help you but please read first and ask questions later
     
    cougarxs, Oct 1, 2008 IP
  5. stevetp

    stevetp Peon

    Messages:
    101
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    There are also ready made solutions for this like aweber and getresponse. I'm not sure if that will help but I too would like to know the ins and outs of this. I can create the form on the page but its the controlling what happens behind the scenes that I don't understand.
     
    stevetp, Oct 1, 2008 IP
  6. methodcomptech

    methodcomptech Peon

    Messages:
    26
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    you need to learn php man.
    here is a quick example...

    
    <?php
    
    // Set the database access information as constants.
    DEFINE ('DB_NAME', 'DB'); // PUT YOUR DATABASE NAME HERE
    DEFINE ('DB_HOST', 'localhost'); // PUT YOUR HOST NAME HERE, NORMALLY LOCALHOST
    DEFINE ('DB_USER', 'USER'); // PUT THE DB USER NAME HERE
    DEFINE ('DB_PASSWORD', 'PASS'); // PUT THE DB USER PASSWORD HERE
    
    // Make the connection.
    $dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could cont connect to MySQL: ' . mysql_error() );
    
    // Select the database.
    mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() );
    
    ?>
    
    <form action="index.php?action=addme" method="post">
        <input name="email" type="text" onfocus="this.value=''" value="Please type your e-mail here." size="50">
        <input type="submit" name="Submit" value="Submit"><input name="submitted" type="hidden" value="TRUE">
    </form>
    
    <?php 
    
    if(isset($_GET['action'])) {  // Start action check
    
        // Check if the form has been submitted.
        if ($_GET['action'] == 'addme') {
    
            $email = $_POST['email'];
    
            // Check for duplicate e-mail
            $emailCheck = "SELECT email FROM maillist WHERE email='$email'";
            $checkResult=mysql_query($emailCheck);
            $num=mysql_numrows($checkResult);
    
            if ($num > 0){ // if a duplicate e-mail is found, display this message
                echo "<strong>$email</strong>,
                <br/>You are already in our system.<br/><br/>
                If you have found this message to be an error, please submit a new e-mail address, or, contact the webmaster.";
                //echo '<meta http-equiv="refresh" content="2;url=http://www.YOURDOMAIN.com">';
    
            } else { // if a duplicate e-mail is not found, submit it to the database
    
                if (isset($_POST['submitted'])) {
    
                    $errors = array(); // Initialize error array.
    
                    // Check for a valid email address
                    if (!preg_match("/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$/", $_POST['email'])) {
                        $errors[] = 'You need to enter a valid email address.';
                    }
    
                if (empty($errors)) { //If everything's okay.
    
                    // Get the curent ID number
                    $getID = mysql_query("SELECT * FROM maillist");
                    $disID = mysql_num_rows($getID);
                    $display = $disID+1;
    
                    // Make the Query.
                    $query = "INSERT INTO maillist SET email='$email', display='$display'";
                    $result = mysql_query ($query); // Run the query.
                    if ($result) { // If it ran OK.
    
                        // Send an email
                        $contact = 'YOUREMAIL@DOMAIN.com';
                        $sub = 'SITENAME - New Subscription';
                        
                        $body = "You have a new subscriber to LissaDoll.com.\n\nPlease notify $email when the site is complete.\n\n_______________________________________________________________________\n\nContact form made by Justin St. Germain - iBrightDevelopment.";
                        mail ($contact, $sub, $body, 'From: YOUREMAIL@DOMAIN.com');
    
    
    
                        //Print the message.
                        echo '<strong>Your e-mail address has been added to the mailing list.</strong>
                        <br/>Your e-mail,<strong>'.$email.'</strong>, has been added to our mailing list.'; // Public Message.
    
                        //Include the footer and quit the script (to not show the form).
    
                    } else { // If id did not run OK.
                        echo '<strong>System Error</strong>
                        <br/>You information could not be submitted due to a system error.  We apologize for any inconvenience.<br/><br/>'; // Public Message.
                        echo '<br/>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; // Debugging Message.
    
                        //Include the footer and quit the script (to not show the form).
                    }
    
                    mysql_close(); // Close the database connection.
    
                    } else { // Report the errors.
    
                        echo '<bold>Error</bold>
                        <br/>The following error(s) occured:<br /><br/>
                        <div style="margin-left: 10px; position: relative;"> ';
                        foreach ($errors as $msg) { // Print each error.
                            echo "- $msg<br />\n";
                        }
                        echo '</div><br/>Please try again<br/><br/>';
    
                    } // End of if OK.
                } // End of the main Submit conditional.
    
            } // End of duplicate email Else statement.
    
        } // End of NOTIFY action.
    
    } // End of action check
    
    ?>
    
    PHP:
     
    methodcomptech, Oct 1, 2008 IP
  7. chathura87

    chathura87 Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    It seems this forum will give the answer for my question

    What i need is my php program should send mails and it should get the coming emails and get the senders email address, body and subject and send that 3 values to the mysql database! it should happen without any manual transaction

    Thank you
     
    chathura87, Oct 1, 2008 IP
  8. methodcomptech

    methodcomptech Peon

    Messages:
    26
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    you english is a little hard to understand there chatura87, but, if you mean you need a for for someone to fill out and send you an email and submit the information to the database, then look at my first post, it does just that. you would just need to add a field for comments, and a name, and add the columns to the db to store the info. if that is not what you meant, try to re-phrase your question.
     
    methodcomptech, Oct 1, 2008 IP
  9. palme

    palme Active Member

    Messages:
    320
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #9
    your problem can not be solved with only html code , you must know about database and a programming language like php or asp, but...
    if you search about free mailing list , you can make it, and download one of them and use it. that is very simple and functional.
     
    palme, Oct 1, 2008 IP
  10. methodcomptech

    methodcomptech Peon

    Messages:
    26
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    or, they could look at my post above and be done with it instead of searching around. ;)
     
    methodcomptech, Oct 1, 2008 IP
  11. albag999

    albag999 Active Member

    Messages:
    289
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #11
    kk. thanks guys.
     
    albag999, Oct 1, 2008 IP