Super Simple Post Script?

2 replies
  • WEB DESIGN
  • |
Hey everyone,

I am creating a test landing page for a new service I want to offer (outside the IM industry) in order to gauge the interest of my market.

I want to create a simple email field where the visitor's email is stored in a text file after they click submit.

I don't have much knowledge at all with coding, so I was wondering if anyone could point me in the right direction!

I don't want to use the website form services offered, because they all have ugly links directing to their website at the bottom of each form.

Thanks
#post #script #simple #super
  • Profile picture of the author frenchsquared
    Replace the $stringData with your email variable
    In this example the text file is called testFile.txt and
    in the same folder. You can change that "/myfolder/testFile.text"

    <?php
    $myFile = "testFile.txt";
    $fh = fopen($myFile, 'w') or die("can't open file");
    $stringData = "Bobby Bopper\n";
    fwrite($fh, $stringData);
    fclose($fh);
    ?>
    {{ DiscussionBoard.errors[5414498].message }}
  • Profile picture of the author bh8vn
    HTML:
    Code:
    <table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
    <tr>
    <td><strong>Contact Form </strong></td>
    </tr>
    </table>
    
    <table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
    <tr>
    <td><form name="form1" method="post" action="send_contact.php">
    <table width="100%" border="0" cellspacing="1" cellpadding="3">
    <tr>
    <td width="16%">Subject</td>
    <td width="2%">:</td>
    <td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
    </tr>
    <tr>
    <td>Detail</td>
    <td>:</td>
    <td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
    </tr>
    <tr>
    <td>Name</td>
    <td>:</td>
    <td><input name="name" type="text" id="name" size="50"></td>
    </tr>
    <tr>
    <td>Email</td>
    <td>:</td>
    <td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
    </tr>
    </table>
    </form>
    </td>
    </tr>
    </table>
    And php

    Code:
    <?php
    // Contact subject
     =""; 
    // Details
    ="";
    
    // Mail of sender
    =""; 
    // From 
    ="from:  <>";
    
    // Enter your email address
     ='someone@somewhere.com';
    
    =mail(,,,);
    
    // Check, if message sent to your email 
    // display message "We've recived your information"
    if(){
    echo "We've recived your contact information";
    }
    else {
    echo "ERROR";
    }
    ?>
    Sorry if it not help
    {{ DiscussionBoard.errors[5415047].message }}

Trending Topics