PHP Form - Needed help

Discussion in 'PHP' started by napnetworks, Sep 27, 2011.

  1. #1
    Hi,

    I would need some help from someone who is willing to help me, and I will appreciate that.

    Well, I have an website with abt. 20K Unique visitors per day, and I want to "subscribe" them.

    Therefore I need to create an form with Name, Surname, Address 1, Address 2, City, Country, Zip, Telephone, Email, Comment box and maybe 2 other forms.

    After visitor writes down and click submit button I need to send an email to the user.. Thank you email..

    Also I need to store his information on an csv file somewhere in Server, not each user on seperate csv file, but all in one scv file.

    Well..

    My problem may be from beginning but where I don't understand most.. I don't have clue how to do it is to save details on csv.

    Thanks in advance,
    Regards
     
    napnetworks, Sep 27, 2011 IP
  2. Sky AK47

    Sky AK47 Member

    Messages:
    298
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    45
    #2
    I assume you need the CSV file in order to email these people?
    I'd suggest using a database, and export it through phpmyadmin/write your own script to export.
    If not, you'd need to use functions like fputcsv and fgetcsv.
    This tutorial might help you.
     
    Sky AK47, Sep 27, 2011 IP
  3. napnetworks

    napnetworks Member

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #3
    Sky Ak47.

    Thnx bro!

    It helped me very much.

    Is there any ready script which does the same?
    I don't have so much time on developing new one ?

    Thnx in advace
     
    napnetworks, Sep 27, 2011 IP
  4. tnhomestead

    tnhomestead Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    A quick google search turned up this site http://www.quadodo.net/, It is pretty easy to setup a basic login/out script yourself.
     
    tnhomestead, Sep 27, 2011 IP
  5. SheetalCreation

    SheetalCreation Peon

    Messages:
    42
    Likes Received:
    1
    Best Answers:
    3
    Trophy Points:
    0
    #5
    For this you need to create a client side form for all the required fields. and small javascript code to validate user data. Small php script for inorder to receive user entered data and save them in csv. Make sure before writing data in csv you are validating them once again on server side(in php code).
    This is easily doable...
    If you need any left to write it, let me know i can help you.

    Sheetal
     
    SheetalCreation, Sep 27, 2011 IP
  6. amherstsowell

    amherstsowell Peon

    Messages:
    261
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    <?php

    if(!isset($_POST['submit']))

    }else{
    if(!isset($_POST['first_name']) ¦¦ strlen($_POST['first_name']) <= 0)
    {
    echo 'Error: You did not enter first name.<br />';
    exit();
    }
    if(!isset($_POST['last_name']) ¦¦ strlen($_POST['last_name']) <= 0)
    {
    echo 'Error: You did not enter your last name.<br />';
    exit();
    }
    if(!isset($_POST['member_addressl']) ¦¦ strlen($_POST['member_address']) <= 0)
    {
    echo 'Error: You did not enter your address.<br />';
    exit();
    }
    if(!isset($_POST['address2']) ¦¦ strlen($_POST['address2']) <= 0)
    {
    echo 'Error: You did not enter your address2<br />';
    exit();
    }
    if(!isset($_POST['member_city']) ¦¦ strlen($_POST['member_city']) <= 0)
    {
    echo 'Error: You did not enter your City<br />';
    exit();

    }
    if(!isset($_POST['member_state']) ¦¦ strlen($_POST['member_state']) <= 0)
    {
    echo 'Error: You did not enter your State<br />';
    exit();

    }
    if(!isset($_POST['member_email']) ¦¦ strlen($_POST['member_email']) <= 0)
    {
    echo 'Error: You did not enter your email Address<br />';
    exit();
    }
    if(!isset($_POST['membership']) ¦¦ strlen($_POST['membership']) <= 0)
    {
    echo 'Error: You did not enter your Membership Level<br />';
    exit();

    }

    {
    echo '<b><center>Thank you for our Membership Application is being processed.</center></b><br/><br/>';

    }

    //send mail.

    $to = $_POST['email'];
    $subject = "Thank you for";
    $message .= "First Name: " . $_POST['first_name'] . "\n";
    $message .= "Last Name: " . $_POST['last_name'] . "\n";
    $message .= "email: " . $_POST['member_email'] . "\n";
    $message .= "Joined the blah blah.....\n";
    $message .= "send membership information asap";

    if (mail ($to, $subject, $message, 'From: $email\n')) {

    echo 'Again....Thanks for joining.<a href="#">
    Back to Message Board</a>';

    }

    }

    ?>
     
    amherstsowell, Sep 27, 2011 IP
  7. Shamrocks

    Shamrocks Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    That is one of the reasons that i started using PHP code generators, if i try to do it coding, by myself i would have to search a bit to remember stuff, and I would lose something like 30mins to 2 hours to do it, depending on the complexity of the things.

    Using scriptcase (my favorite php code generator) I would never lose more then 5 minutes to do something like this.
     
    Shamrocks, Oct 11, 2011 IP
  8. HuggyEssex

    HuggyEssex Member

    Messages:
    297
    Likes Received:
    4
    Best Answers:
    2
    Trophy Points:
    45
    #8
    That code is terrible don't use it, also not protecting against mail header attacks tut tut.
     
    HuggyEssex, Oct 11, 2011 IP
  9. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #9
    That's fine if you don't mind the overhead, server load and slowness, but the code ScriptCase generates for a simple "write the info to a csv file and send an email" function is like buying a herd of elephants, keeping them in a huge cage, and lowering the cage onto a peanut to crack the shell. Rube Goldberg would be proud.

    Learn programming, learn some Javascript and PHP, and a script like that will take you about 5 minutes to conceive, write, debug and deploy. About the same time it'll take to do it in a script generator, but secure and extremely light.
     
    Rukbat, Oct 14, 2011 IP
  10. Shamrocks

    Shamrocks Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    That is one of the reason i started using php code generators, i dont want to lose time trying to create code for simple stuff, the one i like the most is scriptcase, go take a look, i think you can use it as trial for free.
    I realy like the email sending, already created some libraries using the scripcase, it is realy usefull.
    I can send you out if you like to.

    Let me know!
     
    Shamrocks, Oct 17, 2011 IP
  11. CoderBlue

    CoderBlue Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    That is always in my head, learn basic PHP or go direct in those code generators.
     
    CoderBlue, Oct 18, 2011 IP
  12. sanath123

    sanath123 Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Sorry i dont know answer on PHP. topic
     
    sanath123, Oct 21, 2011 IP
  13. sanath123

    sanath123 Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    if you know answer please let me know
     
    sanath123, Oct 21, 2011 IP