Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: form problem

  1. #1
    Join Date
    Dec 2005
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default form problem

    I have this quote form I setup, general basic fields. The problem is the form sends only this to the email recipient (my end). It does not include all the info of all fields. I'm not a programmer, so help is appreciated.

    The only thing shown in the email is this:

    Name:

    Email Address:

    Subject:

    Message:


    process.php

    PHP Code:
    <?php
    @extract($_POST);

    $messageText 'Name: ' stripslashes($user_name) . "\r\n";
    $messageText .= 'Email Address: ' stripslashes($email_address) . "\r\n";
    $messageText .= 'Subject: ' stripslashes($subject) . "\r\n";
    $messageText .= 'Message: ' stripslashes($message) . "\r\n";

    $to 'sales@mydomain.com';
    $subject 'Website Contact Form Submission';
    $message $messageText;
    $headers 'From: Form Mailer <sales@mydomain.com>';

    mail($to$subject$message$headers);

    ?>
    Talk Jesus Forums [ Over 100 Fulfilled Prophecies in the Bible ]
    .....................................................................................
    LogicWeb [ Awesome Web Hosting Since 2004 ]

  2. #2
    Join Date
    Dec 2005
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    the form

    Code:
    <form method="post" action="process.php">
    <table>
        <tr>
            <td class="style5" colspan="2" style="height: 25px"><strong>Contact</strong></td>
            <td class="style5" colspan="2" style="height: 25px"><strong>Location</strong></td>
        </tr>
        <tr>
            <td class="style8" style="text-align:left; width: 142px; height: 25px;"><label for="name">Name</label></td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <input name="First_Name" type="text" /></td>
            <td class="style8" style="text-align:left; width: 136px; height: 25px;">Last Name</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <input name="Last_Name" type="text" /></td>
        </tr>
        <tr>
            <td class="style8" style="text-align:left; width: 142px; height: 25px;">City</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <input name="City" type="text" /></td>
            <td class="style8" style="text-align:left; width: 136px; height: 25px;">State</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <input name="State" type="text" /></td>
        </tr>
        <tr>
            <td class="style8" style="text-align:left; width: 142px; height: 25px;">Phone</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <input name="Phone" type="text" /></td>
            <td class="style8" style="text-align:left; width: 136px; height: 25px;">Country</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <input name="Country" type="text" /></td>
        </tr>
        <tr>
            <td class="style8" style="text-align:left; width: 142px; height: 25px;">Email</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <input name="Email" type="text" /></td>
            <td class="style8" style="text-align:left; width: 136px; height: 25px;">Company</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <input name="Company" type="text" /></td>
        </tr>
        <tr>
            <td class="style5" colspan="2" style="height: 25px"><strong>Requirements</strong></td>
            <td class="style5" colspan="2" style="height: 25px">&nbsp;</td>
            </tr>
        <tr>
            <td class="style8" style="text-align:left; width: 142px; height: 25px;">Processor</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <select name="Processor">
            <option></option>
            <option>***   Intel ***</option>
            <option>Celeron</option>
            <option>Pentium IV HT</option>
            <option>Dual Core Xeon</option>
            <option>Quad Core Xeon</option>
            <option>*** AMD ***</option>
            <option>Dual Core Opteron</option>
            </select></td>
            <td class="style8" style="text-align:left; width: 136px; height: 25px;">Second
            Processor</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <input name="Second_Process" type="checkbox" value="Second_Process" /></td>
        </tr>
        <tr>
            <td class="style8" style="text-align:left; width: 142px; height: 25px;">Memory</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <select name="Memory">
            <option></option>
            <option>512MB</option>
            <option>1GB</option>
            <option>2GB</option>
            <option>4GB</option>
            <option>8GB</option>
            <option>12GB</option>
            <option>16GB</option>
            <option>More than 16GB</option>
            </select></td>
            <td class="style8" style="text-align:left; width: 136px; height: 25px;">Disk Drives</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <select name="Disks">
            <option></option>
            <option>*** SATA ***</option>
            <option>160GB</option>
            <option>2x160GB</option>
            <option>1x250GB</option>
            <option>2x250GB</option>
            <option>1x500GB</option>
            <option>2x500GB</option>
            <option>1x1TeraByte</option>
            <option>2x1TeraByte</option>
            <option>*** SCSI ***</option>
            <option>1x36GB</option>
            <option>2x36GB</option>
            <option>1x73GB</option>
            <option>2x73GB</option>
            <option>1x146GB</option>
            <option>2x146GB</option>
            <option>1x300GB</option>
            <option>2x300GB</option>
            <option>1x400GB</option>
            <option>2x400GB</option>
            </select></td>
        </tr>
        <tr>
            <td class="style8" style="text-align:left; width: 142px; height: 25px;">Quantity of
            Servers</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <select name="Quantity">
            <option></option>
            <option>1</option>
            <option>2</option>
            <option>3-5</option>
            <option>6-12</option>
            <option>12 or more</option>
            </select></td>
            <td class="style8" style="text-align:left; width: 136px; height: 25px;">RAID</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <select name="RAID">
            <option></option>
            <option>None</option>
            <option>Raid 0</option>
            <option>Raid 1</option>
            <option>Raid 3</option>
            <option>Raid 5</option>
            </select></td>
        </tr>
        <tr>
            <td class="style8" style="text-align:left; width: 142px; height: 25px;">IP Address</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <select name="IP_Address0">
            <option></option>
            <option>8</option>
            <option>16</option>
            <option>32</option>
            <option>64</option>
            <option>Half C Class (128)</option>
            <option>C Class (256)</option>
            <option>Multiple C Class</option>
            </select></td>
            <td class="style8" style="text-align:left; width: 136px; height: 25px;">Port</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <select name="Port0">
            <option></option>
            <option>100MBps</option>
            <option>Dual 100MBps</option>
            <option>1GBps</option>
            <option>Dual 1GBps</option>
            <option>Other</option>
            </select></td>
        </tr>
        <tr>
            <td class="style8" style="text-align:left; width: 142px; height: 25px;">
            Operating System</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <select name="Operating_System">
            <option></option>
            <option>*** Linux ***</option>
            <option>Centos</option>
            <option>Debian</option>
            <option>Fedora</option>
            <option>Free BSD</option>
            <option>Gentoo</option>
            <option>Redhat Enterprise</option>
            <option>Ubuntu Server</option>
            <option>*** Windows ***</option>
            <option>Windows Server 2003</option>
            <option>Windows Server 2008</option>
            </select></td>
            <td class="style8" style="text-align:left; width: 136px; height: 25px;">
            Control Panel</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <select name="Control_Panel">
            <option></option>
            <option>Cpanel / WHM</option>
            <option>Interworx</option>
            <option>Helm</option>
            <option>Plesk</option>
            <option>Webmin</option>
            </select></td>
        </tr>
        <tr>
            <td class="style5" colspan="2" style="height: 25px"><strong>Optional
            Services</strong></td>
            <td class="style5" colspan="2" style="height: 25px">&nbsp;</td>
            </tr>
        <tr>
            <td class="style8" style="text-align:left; width: 142px; height: 25px;">Server
            Management</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <input name="Management" type="checkbox" value="Management" /></td>
            <td class="style8" style="text-align:left; width: 136px; height: 25px;">Remote Reboot</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <input name="Remote_Reboot" type="checkbox" value="Remote_Reboot" /></td>
        </tr>
        <tr>
            <td class="style8" style="text-align:left; width: 142px; height: 25px;">Clustering</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <input name="Clustering" type="checkbox" value="Clustering" />&nbsp;</td>
            <td class="style8" style="text-align:left; width: 136px; height: 25px;">NAS
            Backups</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;">
            <input name="NAS" type="checkbox" value="NAS" /></td>
        </tr>
        <tr>
            <td class="style8" style="text-align:left; width: 142px; height: 25px;">Phase</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;"><select name="Mode">
            <option></option>
            <option>Actively Shopping</option>
            <option>Budgetary Numbers</option>
            <option>Researching</option>
            </select></td>
            <td class="style8" style="text-align:left; width: 136px; height: 25px;">Criteria</td>
            <td class="style8" style="text-align:left; width: 140px; height: 25px;"><select name="Criteria">
            <option></option>
            <option>Budgetary</option>
            <option>Location</option>
            <option>Provisioning Time</option>
            <option>SLA</option>
            </select></td>
        </tr>
        <tr>
            <td class="style4" colspan="4">Message<br />
            <textarea name="Message" cols="50" rows="4"></textarea>&nbsp;</td>
        </tr>
    </table>
    <input name="Submit1" type="submit" value="submit" />
    </form>
    Talk Jesus Forums [ Over 100 Fulfilled Prophecies in the Bible ]
    .....................................................................................
    LogicWeb [ Awesome Web Hosting Since 2004 ]

  3. #3
    Join Date
    Oct 2006
    Posts
    94
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    You haven't actually posted any of the information from the form to the PHP page.

    Here's what you are missing from your php script...

    PHP Code:
    $First_Name $_POST['First_Name'];
    $Last_Name $_POST['Last_Name'];
    and 
    so on..... 
    Just repeat the same process for each piece of information you are posting. Whatever the field is called, first one input name = "First_Name", that's what needs to be posted.

    Hope this helps.

    Smithster.

  4. #4
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    There is a faster way. Try
    Code:
    Extract($_POST, EXTR_PREFIX_SAME, "POST");
    It will get all of that for you. I used to do it long hand as well, until I found this
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  5. #5
    Join Date
    Oct 2006
    Posts
    94
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    wow! I have never seen that before?!?!? Can you include security in that statement though with it pulling everything from the form in one go?

  6. #6
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    Quote Originally Posted by smithster View Post
    wow! I have never seen that before?!?!? Can you include security in that statement though with it pulling everything from the form in one go?
    Perhaps. I haven't tried too hard. One of these days I'll have to check. Maybe:
    Code:
    strip_tags(Extract($_POST, EXTR_PREFIX_SAME, "POST"));
    (Again, I don't know if that works or not. . .)
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  7. #7
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    I don't see those fields anywhere in your form Chadi. Are you sure the info is coming in?
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  8. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Why use extract? That's just bad practice.

    Use $_POST['field_name'] to get any value.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #9
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    How is it bad practice? In certain senarios I think it's advantageous. And, I really don't see the difference in the outcome. Both use the same amount of vars, but one takes less time and space.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  10. #10
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Extract is almost like using register_globals, if you use extract at the top of your php script; then later on use a variable of the same name it will overwrite the first value of that same variable. Example:

    Code:
    //extract and other code here
    
    echo $first_name;
    
    //more code here
    
    $first_name = $_GET['something'];
    
    echo $first_name;
    
    //more code
    Probably not the best example, but you get the idea.
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •