sendmail.php problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kgrenier12
    New Member
    • May 2007
    • 2

    sendmail.php problem

    I'm new at using php.

    I am creating a basic html "contact us" form using php to send the data securely via email.

    I posted the form and the screen turns blank when I hit the "submit" button.

    Server is running PHP 5.2 with Mysql 5 and Apache 2
    Viewing the page with Mozilla Firefox Browser 2.0
    Site is wrapped in a custom tailored CMS based on Cake

    Code is below...

    sendmail.php code...
    [CODE=php]
    <?php
    if (isset($_POST['submitted'])) {
    $errors = array();
    if (empty($_POST['name'])) {
    $errors[] = 'You did not enter your name.';
    }
    else {
    $name = $_POST['name'];
    }
    if (empty($_POST['email'])) {
    $errors[] = 'You did not enter an email address.';
    }
    else {
    $email = $_POST['email'];
    }
    if (empty($_POST['company'])) {
    $errors[] = 'You enter company name.';
    }
    else {
    $company = $_POST['company'];
    }
    if (empty($_POST['title'])) {
    $errors[] = 'You did not enter a title.';
    }
    else {
    $title = $_POST['title'];
    }
    if (empty($_POST['phone'])) {
    $errors[] = 'You did not your phone number.';
    }
    else {
    $phone = $_POST['phone'];
    }
    if (empty($_POST['projname'])) {
    $errors[] = 'You did not enter your project name.';
    }
    else {
    $projname = $_POST['projname'];
    }
    if (empty($_POST['projectpurp'])) {
    $errors[] = 'You did not enter your project\'s purpose.';
    }
    else {
    $projectpurp = $_POST['projectpurp'];
    }
    if (empty($_POST['operatingsys'])) {
    $errors[] = 'You did not enter operating system.';
    }
    else {
    $operatingsys = $_POST['operatingsys'];
    }
    if (empty($_POST['projdescript'])) {
    $errors[] = 'You did not enter a proj description.';
    }
    else {
    $projdescript = $_POST['projdescript'];
    }
    if (empty($_POST['howfindsite'])) {
    $errors[] = 'You did not enter how you found our site.';
    }
    else {
    $howfindsite = $_POST['howfindsite'];
    }
    if (empty($_POST['deploytimefram e'])) {
    $errors[] = 'You did not enter a deployment timeframe.';
    }
    else {
    $deploytimefram e= $_POST['deploytimefram e'];
    }

    if (empty($errors) ) { // No errors happened
    $emailmessage = "The following customer inquiry was made:\n
    $name\n$email\n $company\n$titl e\n$phone\n$pro jname\n$projpur purp\n$operatin gsys\n$projdesc ript\n$howfinds ite\n$deploytim eframe";
    mail( "name@name. com, name12@name.com ", "Identifind er Customer Inquiry",
    "$emailmessage" , "From: $email" );
    header( "Location: /identifinder_co ntact_us/identifinder_co ntact_form_than k_you" );
    }
    else {
    foreach ($errors as $msg) {
    echo '<li> '.$msg.'</li>';
    }
    }
    }
    ?>

    [/CODE]

    contact form html code
    [CODE=html]
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitl ed Document</title>
    </head>

    <body>
    <div class="textWrap ">

    <h4><span class="highligh t">Thank you</span> for your interest in Name Technologies.</h4>
    <h6>We will be in touch with you shortly.</h6>



    <form method="POST" action="/php/sendmail.php">
    <table border="0" cellpadding="0" cellspacing="0" >
    <tr>
    <td>
    <p class="formlist ing">Name:&nbsp ;</p> </td>
    <td>
    <input type="text" name="name" value="" size="40" maxlength="64" autocomplete="o ff" /> </td>
    </tr>
    <tr>
    <td>
    <p class="formlist ing">E-mail:&nbsp;</p> </td>
    <td>
    <input type="text" name="email" value="" size="40" maxlength="64" autocomplete="o ff" /> </td>
    </tr>
    <tr>
    <td>
    <p class="formlist ing">Company:&n bsp;</p> </td>
    <td>
    <input type="text" name="company" value="" size="40" maxlength="64" autocomplete="o ff" /> </td>
    </tr>
    <tr>
    <td>
    <p class="formlist ing">Job Title:&nbsp;</p> </td>
    <td>
    <input type="text" name="title" value="" size="40" maxlength="64" autocomplete="o ff" /> </td>
    </tr>
    <tr>
    <td>
    <p class="formlist ing">Phone:&nbs p;</p> </td>
    <td>
    <input type="text" name="phone" value="" size="40" maxlength="40" autocomplete="o ff" /> </td>
    </tr>

    <tr>
    <td>
    <p class="formlist ing">Project Name:&nbsp;</p> </td>
    <td>
    <input type="text" name="projname" value="" size="40" maxlength="40" autocomplete="o ff" /> </td>
    </tr>
    <tr>
    <td>
    <p class="formlist ing">Project Purpose:&nbsp;</p> </td>
    <td><select name="projectpu rp">
    <option value="">&nbsp; </option>
    <option value="SEARCH"> Internal company prototype</option>
    <option value="WRDMTH"> Research - Academic</option>
    <option value="MAGADV"> Research - Commercial</option>
    <option value="OTHER">O ther - Enter Purpose</option>
    </select></td>
    </tr>




    </p>

    <tr>
    <td>
    <p class="formlist ing">Operating System:&nbsp;</p> </td>
    <td>

    <select name="operating sys">
    <option value="">&nbsp; </option>
    <option value="SEARCH"> Windows XP</option>
    <option value="WRDMTH"> 2003</option>
    <option value="MAGADV"> Linux</option>
    <option value="OTHER">O ther</option>
    </select> </td>
    </tr>
    </table>
    <p class="formlist ing"><br />Please type a few sentences describing the nature of your project</p>
    <p class="formlist ing"><textarea name="projdescr ipt" rows="4" cols="54" wrap="virtual"> </textarea></p>
    <p class="formlist ing">You found our site via:</p>
    <p class="formlist ing">
    <select name="howfindsi te">
    <option value="">&nbsp; </option>
    <option value="SEARCH"> Search engine</option>
    <option value="WRDMTH"> Word of mouth</option>
    <option value="MAGADV"> Magazine advertisement</option>
    <option value="TRDCNF"> Trade show/Conference</option>
    <option value="OTHER">O ther</option>
    </select>
    </p>

    <p class="formlist ing">If a commercial entity, how long until you hope to deploy IdentiFinder commercially?</p>
    <p class="formlist ing">
    <select name="deploytim eframe">
    <option value="">&nbsp; </option>
    <option value="NOT">not commercial entity</option>
    <option value="3">3 months</option>
    <option value="6">6mont hs</option>
    <option value="1">1 year</option>
    <option value="unk">unk nown</option>
    </select>
    </p>


    <p style="text-align: center;"><input type="submit" value="Submit" /></p>
    </form>

    </div>
    </body>
    </html>
    [/CODE]
    Last edited by pbmods; May 15 '07, 05:42 PM. Reason: Changed code language. Thanks for using CODE tags!
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, kgrenier12. Welcome to TSDN!

    My initial guess would be that your script is hitting an error, but it's not set up to display errors (the usual suspect when a script turns up blank). Check out this article:

    Comment

    • kgrenier12
      New Member
      • May 2007
      • 2

      #3
      Originally posted by pbmods
      Heya, kgrenier12. Welcome to TSDN!

      My initial guess would be that your script is hitting an error, but it's not set up to display errors (the usual suspect when a script turns up blank). Check out this article:

      http://www.thescripts.com/forum/thread629295.html
      My apologies for not doing that BEFORE I sent my message in.

      I changed my php settings inside sendmail.php and still receive a blank screen.
      I'm hesitant to change the global php ini settings because it's a production site.

      I did notice that my file properties on the server are "RW" only not "RWX" do you think that would contribute to the problem? I am currently trying to reset the file property settings inside ftp but have been unsuccessful.

      Thanks for your help,
      Kgrenier12

      Comment

      Working...