a different contact form ... please help!!!!

Discussion in 'PHP or PERL Snips' started by WolfTrance, Aug 10, 2006.

  1. WolfTrance

    WolfTrance Guppy

    can someone tell me how to include all of the input fields in the form below please????


    PHP:
    <?php

    if ($_POST[t] == 'process'){

    mail('support@website.com','Contact Form Submission',stripslashes($_POST[message]),'FROM:'.$_POST[email]);

    echo
    '<table border="0" width="98%" cellspacing="3" cellpadding="0"><tr><td width="100%" valign="top" align="center" class="content">';
    echo
    '<br /><br /><p>Thank you, your message was sent to the webmaster.</p>'."";
    echo
    '</td></tr></table>';

    } else {

    echo
    '<form action="'.$_SERVER[PHP_SELF].'" method="post">'."";
    echo
    '<input type="hidden" name="t" value="process"></input>'."";
    echo
    'Your E-Mail Address: <input type="text" name="email" size="30" value=""></input><br /><br />'."";
    echo
    'Your name: <input type="text" name="name" size="20"><br /><br />'."";
    echo
    'Your phone: <input type="text" name="phone" size="20"><br /><br />'."";
    echo
    'Select subject: <select size="1" name="subject">
        <option selected>Wants List</option>
        <option>Book Purchase</option>
        <option>Shipping</option>
        <option>Request To View A Book</option>
        <option>Books For Sale</option>
        <option>Returns</option>
        <option>Other</option>
      </select><br /><br />'
    ."";
    echo
    'Preferred way of contact? <input type="checkbox" name="contactemail" value="ON">email <input type="checkbox" name="contactphone" value="ON">phone<br /><br />'."";
    echo
    'Your Message:<br /><textarea name="message" cols="30" rows="8"></textarea><br /><br />'."";
    echo
    '<input type="submit" value="Send E-Mail"></input>'."";
    echo
    '</form>';
    }
    ?>
  2. WolfTrance

    WolfTrance Guppy

    Just incase someone else finds this and needs it, here is a working version of the script ...

    PHP:
    <?php

    if ($_POST[t] == 'process'){

     
    $msg ""
    foreach (
    $_POST as $key => $value) { 
        if(
    $key <> "t"){ 
            
    $msg .= "$key$value\n"
        } 
    }  
    mail('support@website.com','Contact Form Submission',stripslashes($msg),'FROM: support@website.com');

    echo
    '<table border="0" width="98%" cellspacing="3" cellpadding="0"><tr><td width="100%" valign="top" align="center" class="content">';
    echo
    '<br /><br /><p>Thank you, your message was sent to the webmaster.</p>'."";
    echo
    '</td></tr></table>';

    } else {

    echo
    '<form action="'.$_SERVER[PHP_SELF].'" method="post">'."";
    echo
    '<input type="hidden" name="t" value="process"></input>'."";
    echo
    'Your E-Mail Address: <input type="text" name="email" size="30" value=""></input><br /><br />'."";
    echo
    'Your name: <input type="text" name="name" size="20"><br /><br />'."";
    echo
    'Your phone: <input type="text" name="phone" size="20"><br /><br />'."";
    echo
    'Select subject: <select size="1" name="subject">
        <option selected>Wants List</option>
        <option>Book Purchase</option>
        <option>Shipping</option>
        <option>Request To View A Book</option>
        <option>Books For Sale</option>
        <option>Returns</option>
        <option>Other</option>
      </select><br /><br />'
    ."";
    echo
    'Preferred way of contact? <input type="checkbox" name="contactemail" value="ON">email <input type="checkbox" name="contactphone" value="ON">phone<br /><br />'."";
    echo
    'Your Message:<br /><textarea name="message" cols="30" rows="8"></textarea><br /><br />'."";
    echo
    '<input type="submit" value="Send E-Mail"></input>'."";
    echo
    '</form>';
    }
    ?>

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services