1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

php email issue?

Discussion in 'PHP' started by webber09, Mar 15, 2017.

  1. #1
    Hi guys, i have this rather lengthy php email for but i cannot seem to get it to send... usually a fresh pair of eyes pick up my simple mistakes... here is my codes:

    <form action="./send.php" method="post">
          <table width="100%" border="1" cellspacing="0" cellpadding="0">
            <tr>
              <th width="60%">Product Discription</th>
              <th width="30%">Product Number</th>
              <th width="10%">Quantity Needed</th>
            </tr>
            <tr>
              <td>Coca Cola</td>
              <td>DRK065</td>
              <td><input style="width:30%;" type="text" name="DRK065" value="0" /></td>
            </tr>
            <tr>
              <td>Rio Riva Tropical</td>
              <td>DRK631</td>
              <td><input style="width:30%;" type="text" name="DRK631" value="0" /></td>
            </tr>
            <tr>
              <td>Pepsi</td>
              <td>DRK102</td>
              <td><input style="width:30%;" type="text" name="DRK102" value="0" /></td>
            </tr>
            <tr>
              <td>Diet Pepsi</td>
              <td>DRK697</td>
              <td><input style="width:30%;" type="text" name="DRK697" value="0" /></td>
            </tr>
            <tr>
              <td>Tango Orange</td>
              <td>DRK115</td>
              <td><input style="width:30%;" type="text" name="DRK115" value="0" /></td>
            </tr>
            <tr>
              <td>Emerge</td>
              <td>187915</td>
              <td><input style="width:30%;" type="text" name="187915" value="0" /></td>
            </tr>
            <tr>
              <td>7Up</td>
              <td>DRK044</td>
              <td><input style="width:30%;" type="text" name="DRK044" value="0" /></td>
            </tr>
            <tr>
              <td>Eggs (60)</td>
              <td>EGG011</td>
              <td><input style="width:30%;" type="text" name="EGG011" value="0" /></td>
            </tr>
            <tr>
              <td>Blueroll (6)</td>
              <td>HYG003</td>
              <td><input style="width:30%;" type="text" name="HYG003" value="0" /></td>
            </tr>
            <tr>
              <td>Anti-Bac Fairy</td>
              <td>HYG353</td>
              <td><input style="width:30%;" type="text" name="HYG353" value="0" /></td>
            </tr>
            <tr>
              <td>Tomato Sauce Sachets</td>
              <td>SAU486</td>
              <td><input style="width:30%;" type="text" name="SAU486" value="0" /></td>
            </tr>
            <tr>
              <td>Mayo Sauce Sachets</td>
              <td>SAU487</td>
              <td><input style="width:30%;" type="text" name="SAU487" value="0" /></td>
            </tr>
            <tr>
              <td>Vinegar Sachets</td>
              <td>SAU234</td>
              <td><input style="width:30%;" type="text" name="SAU234" value="0" /></td>
            </tr>
            <tr>
              <td>Cheese &amp; Onion Crisps</td>
              <td>CRP028</td>
              <td><input style="width:30%;" type="text" name="CRP028" value="0" /></td>
            </tr>
            <tr>
              <td>Deli Balsamic Vinegar Crisps</td>
              <td>CRP117</td>
              <td><input style="width:30%;" type="text" name="CRP117" value="0" /></td>
            </tr>
            <tr>
              <td>Deli Chorizo &amp; Onion Crisps</td>
              <td>CRP116</td>
              <td><input style="width:30%;" type="text" name="CRP116" value="0" /></td>
            </tr>
            <tr>
              <td>Beans (6)</td>
              <td>VEG066</td>
              <td><input style="width:30%;" type="text" name="VEG066" value="0" /></td>
            </tr>
            <tr>
              <td>Burger Wraps</td>
              <td>WRA002</td>
              <td><input style="width:30%;" type="text" name="WRA002" value="0" /></td>
            </tr>
            <tr>
              <td>Cooking Oil (20L)</td>
              <td>181801</td>
              <td><input style="width:30%;" type="text" name="181801" value="0" /></td>
            </tr>
            <tr>
              <td>Salad Bowl (20)</td>
              <td>112005</td>
              <td><input style="width:30%;" type="text" name="112005" value="0" /></td>
            </tr>
            <tr>
              <td>Deli Pot/Lid (25)</td>
              <td>174322</td>
              <td><input style="width:30%;" type="text" name="174322" value="0" /></td>
            </tr>
            <tr>
              <td>Napkins</td>
              <td>148295</td>
              <td><input style="width:30%;" type="text" name="148295" value="0" /></td>
            </tr>
            <tr>
              <td>Breaded Scampi Bites</td>
              <td>150836</td>
              <td><input style="width:30%;" type="text" name="150836" value="0" /></td>
            </tr>
            <tr>
              <td>Chopped Tomatos in Juice</td>
              <td>150812</td>
              <td><input style="width:30%;" type="text" name="150812" value="0" /></td>
            </tr>
            <tr>
              <td>Kitchen foil</td>
              <td>148513</td>
              <td><input style="width:30%;" type="text" name="148513" value="0" /></td>
            </tr>
            <tr>
              <td>Blue Gloves</td>
              <td>102168</td>
              <td><input style="width:30%;" type="text" name="102168" value="0" /></td>
            </tr>
            <tr>
              <td>Basil</td>
              <td>129598</td>
              <td><input style="width:30%;" type="text" name="129598" value="0" /></td>
            </tr>
            <tr>
              <td>BBQ Sauce (1L)</td>
              <td>68664</td>
              <td><input style="width:30%;" type="text" name="68664" value="0" /></td>
            </tr>
            <tr>
              <td>Burger Relish (1L)</td>
              <td>70329</td>
              <td><input style="width:30%;" type="text" name="70329" value="0" /></td>
            </tr>
            <tr>
              <td>Burger Sauce (1L)</td>
              <td>68658</td>
              <td><input style="width:30%;" type="text" name="68658" value="0" /></td>
            </tr>
            <tr>
              <td>Caesar Dressing (2.15L)</td>
              <td>129898</td>
              <td><input style="width:30%;" type="text" name="129898" value="0" /></td>
            </tr>
            <tr>
              <td>Chilli Powder</td>
              <td>129646</td>
              <td><input style="width:30%;" type="text" name="129646" value="0" /></td>
            </tr>
            <tr>
              <td>French Dressing (2.15L)</td>
              <td>129892</td>
              <td><input style="width:30%;" type="text" name="129892" value="0" /></td>
            </tr>
            <tr>
              <td>Long Grain Rice</td>
              <td>719526</td>
              <td><input style="width:30%;" type="text" name="719526" value="0" /></td>
            </tr>
            <tr>
              <td>Fusilli Pasta Twists</td>
              <td>395277</td>
              <td><input style="width:30%;" type="text" name="395277" value="0" /></td>
            </tr>
            <tr>
              <td>Ground Turmeric</td>
              <td>129664</td>
              <td><input style="width:30%;" type="text" name="129664" value="0" /></td>
            </tr>
            <tr>
              <td>Madras Curry Powder</td>
              <td>129649</td>
              <td><input style="width:30%;" type="text" name="129649" value="0" /></td>
            </tr>
            <tr>
              <td>Mayonnaise (1L)</td>
              <td>68669</td>
              <td><input style="width:30%;" type="text" name="68669" value="0" /></td>
            </tr>
            <tr>
              <td>Orange Marmalade</td>
              <td>197732</td>
              <td><input style="width:30%;" type="text" name="197732" value="0" /></td>
            </tr>
            <tr>
              <td>Oregano</td>
              <td>129584</td>
              <td><input style="width:30%;" type="text" name="129584" value="0" /></td>
            </tr>
            <tr>
              <td>Paprika</td>
              <td>129612</td>
              <td><input style="width:30%;" type="text" name="129612" value="0" /></td>
            </tr>
            <tr>
              <td>Piri Piri Sauce (1L)</td>
              <td>141296</td>
              <td><input style="width:30%;" type="text" name="141296" value="0" /></td>
            </tr>
            <tr>
              <td>Piri Piri Seasoning Mix</td>
              <td>156607</td>
              <td><input style="width:30%;" type="text" name="156607" value="0" /></td>
            </tr>
            <tr>
              <td>Plain Flour</td>
              <td>483840</td>
              <td><input style="width:30%;" type="text" name="483840" value="0" /></td>
            </tr>
            <tr>
              <td>Rosemary</td>
              <td>129594</td>
              <td><input style="width:30%;" type="text" name="129594" value="0" /></td>
            </tr>
            <tr>
              <td>Seafood Sauce (1L)</td>
              <td>129915</td>
              <td><input style="width:30%;" type="text" name="129915" value="0" /></td>
            </tr>
            <tr>
              <td>Self Raising Flour</td>
              <td>483870</td>
              <td><input style="width:30%;" type="text" name="483870" value="0" /></td>
            </tr>
            <tr>
              <td>Sweet Chilli Sauce (1L)</td>
              <td>68666</td>
              <td><input style="width:30%;" type="text" name="68666" value="0" /></td>
            </tr>
            <tr>
              <td>Thyme</td>
              <td>129596</td>
              <td><input style="width:30%;" type="text" name="129596" value="0" /></td>
            </tr>
            <tr>
              <td>Tomato Ketchup (1L)</td>
              <td>605394</td>
              <td><input style="width:30%;" type="text" name="605394" value="0" /></td>
            </tr>
            <tr>
              <td>Yoghurt &amp; Mint Sauce (1L)</td>
              <td>194113</td>
              <td><input style="width:30%;" type="text" name="194113" value="0" /></td>
            </tr>
            <tr>
              <td>Kitchen Order Pads</td>
              <td>194582</td>
              <td><input style="width:30%;" type="text" name="194582" value="0" /></td>
            </tr>
            <tr>
              <td>Black Refuse Sacks</td>
              <td>199764</td>
              <td><input style="width:30%;" type="text" name="199764" value="0" /></td>
            </tr>
            <tr>
              <td>Anti Bacterial Spray</td>
              <td>190825</td>
              <td><input style="width:30%;" type="text" name="190825" value="0" /></td>
            </tr>
            <tr>
              <td>Thick Bleach (25L)</td>
              <td>191399</td>
              <td><input style="width:30%;" type="text" name="191399" value="0" /></td>
            </tr>
            <tr>
              <td>Triple Sandwich Box</td>
              <td>90576</td>
              <td><input style="width:30%;" type="text" name="90576" value="0" /></td>
            </tr>
            <tr>
              <td>12oz Cup Lids</td>
              <td>192267</td>
              <td><input style="width:30%;" type="text" name="192267" value="0" /></td>
            </tr>
            <tr>
              <td>12oz Cups</td>
              <td>192253</td>
              <td><input style="width:30%;" type="text" name="192253" value="0" /></td>
            </tr>
            <tr>
              <td>Pure Orange Juice</td>
              <td>130106</td>
              <td><input style="width:30%;" type="text" name="130106" value="0" /></td>
            </tr>
            <tr>
              <td>Doilies (250 30x40cm)</td>
              <td>106512</td>
              <td><input style="width:30%;" type="text" name="106512" value="0" /></td>
            </tr>
            <tr>
              <td>Flapjacks</td>
              <td>143128</td>
              <td><input style="width:30%;" type="text" name="143128" value="0" /></td>
            </tr>
            <tr>
              <td>Corn Flakes To Go</td>
              <td>183329</td>
              <td><input style="width:30%;" type="text" name="183329" value="0" /></td>
            </tr>
            <tr>
              <td>Crunchy Nut To Go</td>
              <td>183677</td>
              <td><input style="width:30%;" type="text" name="183677" value="0" /></td>
            </tr>
            <tr>
              <td>Kingsmill Bread (Medium Cut)</td>
              <td>73795</td>
              <td><input style="width:30%;" type="text" name="73795" value="0" /></td>
            </tr>
            <tr>
              <td>Kingsmill Bread (Thick Cut)</td>
              <td>73793</td>
              <td><input style="width:30%;" type="text" name="73793" value="0" /></td>
            </tr>
            <tr>
              <td>Kingsmill Wholemill Bread (Thick Cut)</td>
              <td>73768</td>
              <td><input style="width:30%;" type="text" name="73768" value="0" /></td>
            </tr>
            <tr>
              <td>Tortilla Box (25)</td>
              <td>194376</td>
              <td><input style="width:30%;" type="text" name="194376" value="0" /></td>
            </tr>
            <tr>
              <td>Red Kidney Beans</td>
              <td>163706</td>
              <td><input style="width:30%;" type="text" name="163706" value="0" /></td>
            </tr>
            <tr>
              <td>Apple Juice (8x250ml)</td>
              <td>172902</td>
              <td><input style="width:30%;" type="text" name="172902" value="0" /></td>
            </tr>
            <tr>
              <td>Brown Sauce Sachets</td>
              <td>188472</td>
              <td><input style="width:30%;" type="text" name="188472" value="0" /></td>
            </tr>
            <tr>
              <td>Orange Juice (8x250ml)</td>
              <td>172903</td>
              <td><input style="width:30%;" type="text" name="172903" value="0" /></td>
            </tr>
            <tr>
              <td>Salt Sachets</td>
              <td>917110</td>
              <td><input style="width:30%;" type="text" name="917110" value="0" /></td>
            </tr>
            <tr>
              <td>Tartare Sauce Sachets</td>
              <td>189128</td>
              <td><input style="width:30%;" type="text" name="189128" value="0" /></td>
            </tr>
            <tr>
              <td>M&amp;M's Chocolate (24)</td>
              <td>173349</td>
              <td><input style="width:30%;" type="text" name="173349" value="0" /></td>
            </tr>
            <tr>
              <td>M&amp;M's Peanut (24)</td>
              <td>986752</td>
              <td><input style="width:30%;" type="text" name="986752" value="0" /></td>
            </tr>
            <tr>
              <td>Assorted Cake Slices</td>
              <td>123207</td>
              <td><input style="width:30%;" type="text" name="123207" value="0" /></td>
            </tr>
            <tr>
              <td>Assorted Tartlets</td>
              <td>135436</td>
              <td><input style="width:30%;" type="text" name="135436" value="0" /></td>
            </tr>
            <tr>
              <td>Bakewell Tarts </td>
              <td>122893</td>
              <td><input style="width:30%;" type="text" name="122893" value="0" /></td>
            </tr>
            <tr>
              <td>Mars</td>
              <td>146899</td>
              <td><input style="width:30%;" type="text" name="146899" value="0" /></td>
            </tr>
            <tr>
              <td>Chicken Soup</td>
              <td>133117</td>
              <td><input style="width:30%;" type="text" name="0133117" value="0" /></td>
            </tr>
            <tr>
              <td>Fish Batter Mix</td>
              <td>9084</td>
              <td><input style="width:30%;" type="text" name="9084" value="0" /></td>
            </tr>
            <tr>
              <td>Minestrone Soup</td>
              <td>133114</td>
              <td><input style="width:30%;" type="text" name="133114" value="0" /></td>
            </tr>
            <tr>
              <td>Tomato Soup</td>
              <td>133506</td>
              <td><input style="width:30%;" type="text" name="133506" value="0" /></td>
            </tr>
            <tr>
              <td>Plain Tortilla Wraps</td>
              <td>133858</td>
              <td><input style="width:30%;" type="text" name="133858" value="0" /></td>
            </tr>
            <tr>
              <td>Nescafé Coffee</td>
              <td>198345</td>
              <td><input style="width:30%;" type="text" name="198345" value="0" /></td>
            </tr>
            <tr>
              <td>Oat So Simple (Golden Syrup)</td>
              <td>182358</td>
              <td><input style="width:30%;" type="text" name="182358" value="0" /></td>
            </tr>
            <tr>
              <td>Fajita Spice Mix</td>
              <td>174242</td>
              <td><input style="width:30%;" type="text" name="174242" value="0" /></td>
            </tr>
            <tr>
              <td>Snickers</td>
              <td>146947</td>
              <td><input style="width:30%;" type="text" name="146947" value="0" /></td>
            </tr>
            <tr>
              <td>McCoys Cheddar &amp; Onion Crisps</td>
              <td>145526</td>
              <td><input style="width:30%;" type="text" name="145526" value="0" /></td>
            </tr>
            <tr>
              <td>Twix</td>
              <td>141653</td>
              <td><input style="width:30%;" type="text" name="141653" value="0" /></td>
            </tr>
            <tr>
              <td>Max Flame Grilled Steak Crisps</td>
              <td>200655</td>
              <td><input style="width:30%;" type="text" name="200655" value="0" /></td>
            </tr>
            <tr>
              <td>Sugar</td>
              <td>148694</td>
              <td><input style="width:30%;" type="text" name="148694" value="0" /></td>
            </tr>
            <tr>
              <td>Hot Dogs</td>
              <td>110055</td>
              <td><input style="width:30%;" type="text" name="110055" value="0" /></td>
            </tr>
            </table>
            <table width="100%" border="1" cellspacing="0" cellpadding="0">
            <tr>
              <td>Your Name: <br /><input style="width:70%;" type="text" name="name" /></td>
              <td>Site Location:<br /><input style="width:70%;" type="text" name="site" /></td>
              <td><input type="submit" name="submit" value="Submit" /></td>
            </tr>
          </table>
          </form>
    HTML:
    and in the send.php

    <?php
    $name = $_POST['name'];
    $site = $_POST['site'];
    $DRK065 = $_POST['DRK065'];
    $DRK631 = $_POST['DRK631'];
    $DRK102 = $_POST['DRK102'];
    $DRK697 = $_POST['DRK697'];
    $DRK115 = $_POST['DRK115'];
    $187915 = $_POST['187915'];
    $DRK044 = $_POST['DRK044'];
    $EGG011 = $_POST['EGG011'];
    $HYG003 = $_POST['HYG003'];
    $HYG353 = $_POST['HYG353'];
    $SAU486 = $_POST['SAU486'];
    $SAU487 = $_POST['SAU487'];
    $SAU234 = $_POST['SAU234'];
    $CRP028 = $_POST['CRP028'];
    $CRP117 = $_POST['CRP117'];
    $CRP116 = $_POST['CRP116'];
    $VEG066 = $_POST['VEG066'];
    $WRA002 = $_POST['WRA002'];
    $181801 = $_POST['181801'];
    $112005 = $_POST['112005'];
    $174322 = $_POST['174322'];
    $148295 = $_POST['148295'];
    $150836 = $_POST['150836'];
    $150812 = $_POST['150812'];
    $148513 = $_POST['148513'];
    $102168 = $_POST['102168'];
    $129598 = $_POST['129598'];
    $68664 = $_POST['68664'];
    $70329 = $_POST['70329'];
    $68658 = $_POST['68658'];
    $129898 = $_POST['129898'];
    $129646 = $_POST['129646'];
    $129892 = $_POST['129892'];
    $719526 = $_POST['719526'];
    $395277 = $_POST['395277'];
    $129664 = $_POST['129664'];
    $129649 = $_POST['129649'];
    $68669 = $_POST['68669'];
    $197732 = $_POST['197732'];
    $129584 = $_POST['129584'];
    $129612 = $_POST['129612'];
    $141296 = $_POST['141296'];
    $156607 = $_POST['156607'];
    $483840 = $_POST['483840'];
    $129594 = $_POST['129594'];
    $129915 = $_POST['129915'];
    $483870 = $_POST['483870'];
    $68666 = $_POST['68666'];
    $129596 = $_POST['129596'];
    $605394 = $_POST['605394'];
    $194113 = $_POST['194113'];
    $194582 = $_POST['194582'];
    $199764 = $_POST['199764'];
    $190825 = $_POST['190825'];
    $191399 = $_POST['191399'];
    $90576 = $_POST['90576'];
    $192267 = $_POST['192267'];
    $192253 = $_POST['192253'];
    $130106 = $_POST['130106'];
    $106512 = $_POST['106512'];
    $143128 = $_POST['143128'];
    $183329 = $_POST['183329'];
    $183677 = $_POST['183677'];
    $73795 = $_POST['73795'];
    $73793 = $_POST['73793'];
    $73768 = $_POST['73768'];
    $194376 = $_POST['194376'];
    $163706 = $_POST['163706'];
    $172902 = $_POST['172902'];
    $188472 = $_POST['188472'];
    $172903 = $_POST['172903'];
    $917110 = $_POST['917110'];
    $189128 = $_POST['189128'];
    $173349 = $_POST['173349'];
    $986752 = $_POST['986752'];
    $123207 = $_POST['123207'];
    $135436 = $_POST['135436'];
    $122893 = $_POST['122893'];
    $146899 = $_POST['146899'];
    $133117 = $_POST['133117'];
    $9084 = $_POST['9084'];
    $133114 = $_POST['133114'];
    $133506 = $_POST['133506'];
    $133858 = $_POST['133858'];
    $198345 = $_POST['198345'];
    $182358 = $_POST['182358'];
    $174242 = $_POST['174242'];
    $146947 = $_POST['146947'];
    $145526 = $_POST['145526'];
    $141653 = $_POST['141653'];
    $200655 = $_POST['200655'];
    $148694 = $_POST['148694'];
    $110055 = $_POST['110055'];
    $formcontent='From: $name \n Site: $site \n\n Coca Cola: $DRK065 \n Rio Riva Tropica: $DRK631 \n Pepsi: $DRK102 \n Diet Pepsi: $DRK697 \n Tango Orange: $DRK115 \n Emerge: $187915 \n 7Up: $DRK044 \n Eggs (60): $EGG011 \n Blueroll (6): $HYG003 \n Anti-Bac Fairy: $HYG353 \n Tomato Sauce Sachets: $SAU486 \n Mayo Sauce Sachets: $SAU487 \n Vinegar Sachets: $SAU234 \n Cheese & Onion Crisps: $CRP028 \n Deli Balsamic Vinegar Crisps: $CRP117 \n Deli Chorizo & Onion Crisps: $CRP116 \n Beans (6): $VEG066 \n Burger Wraps: $WRA002 \n Cooking Oil (20L): $181801 \n Salad Bowl (20): $112005 \n Deli Pot/Lid (25): $174322 \n Napkins: $148295 \n Breaded Scampi Bites: $150836 \n Chopped Tomatos in Juice: $150812 \n Kitchen foil: $148513 \n Blue Gloves: $102168 \n Basil: $129598 \n BBQ Sauce (1L): $68664 \n Burger Relish (1L): $70329 \n Burger Sauce (1L): $68658 \n Caesar Dressing (2.15L): $129898 \n Chilli Powder: $129646 \n French Dressing (2.15L): $129892 \n Long Grain Rice: $719526 \n Fusilli Pasta Twists: $395277 \n Ground Turmeric: $129664 \n Madras Curry Powder: $129649 \n Mayonnaise (1L): $68669 \n Orange Marmalade: $197732 \n Oregano: $129584 \n Paprika: $129612 \n Piri Piri Sauce (1L): $141296 \n Piri Piri Seasoning Mix: $156607 \n Plain Flour: $483840 \n Rosemary: $129594 \n Seafood Sauce (1L): $129915 \n Self Raising Flour: $483870 \n Sweet Chilli Sauce (1L): $68666 \n Thyme: $129596 \n Tomato Ketchup (1L): $605394 \n Yoghurt & Mint Sauce (1L): $194113 \n Kitchen Order Pads: $194582 \n Black Refuse Sacks: $199764 \n Anti Bacterial Spray: $190825 \n Thick Bleach (25L): $191399 \n Triple Sandwich Box: $90576 \n 12oz Cup Lids: $192267 \n 12oz Cups: $192253 \n Pure Orange Juice: $130106 \n Doilies (250 30x40cm): $106512 \n Flapjacks: $143128 \n Corn Flakes To Go: $183329 \n Crunchy Nut To Go: $183677 \n Kingsmill Bread (Medium Cut): $73795 \n Kingsmill Bread (Thick Cut): $73793 \n Kingsmill Wholemill Bread (Thick Cut): $73768 \n Tortilla Box (25): $194376 \n Red Kidney Beans: $163706 \n Apple Juice (8x250ml): $172902 \n Brown Sauce Sachets: $188472 \n Orange Juice (8x250ml): $172903 \n Salt Sachets: $917110 \n Tartare Saouce Sachets: $189128 \n M&M's Chocolate (24): $173349 \n M&M's Peanut (24): $986752 \n Assorted Cake Slices: $123207 \n Assorted Tartlets: $135436 \n Bakewell Tarts: $122893 \n Mars: $146899 \n Chicken Soup: $133117 \n Fish Batter Mix: $9084 \n Minestrone Soup: $133114 \n Tomato Soup: $133506 \n Plain Tortilla Wraps: $133858 \n Nescafé Coffee: $198345 \n Oat So Simple (Golden Syrup): $182358 \n Fajita Spice Mix: $174242 \n Snickers: $146947 \n McCoys Cheddar & Onion Crisps: $145526 \n Twix: $141653 \n Max Flame Grilled Steak Crisps: $200655 \n Sugar: $148694 \n Hot Dogs: $110055';
    $recipient="myemail@hotmail.co.uk";
    $subject = "Contact Form";
    $mailheader = "From: $name \r\n";
    mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
    echo "Thank You!" . " -" . "<a href='http://mydomain.com'>Return Home</a>";
    ?>
    PHP:
    thanks in advance (Y)
     
    webber09, Mar 15, 2017 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    Lets start by debugging the code.

    if you output $formcontent do you get what you expect? I'm thinking you don't... try changing the code to something like this... I shortened the string but you should get the jist. Use {} around variable names to ensure the variable is parsed correctly. By replacing \n with actual returns you get more readable code.
    
    $formcontent="From: {$name}
    Site: {$site}
    Coca Cola: {$DRK065}
    Rio Riva Tropica: {$DRK631}
    Pepsi: {$DRK102}
    Diet Pepsi: {$DRK697}
    Tango Orange: {$DRK115}
    Emerge: {$187915}
    7Up: {$DRK044}";
    Code (markup):
    but I'd also consider this change to the form itself and only include the items in the email that are actually being ordered.
    <tr>
    <td>Max Flame Grilled Steak Crisps</td>
    <td>200655</td>
    <td>
    <input type='hidden' name='label[200655]' />
    <input style="width:30%;" type="text" name="product[200655]" value="0" />
    </td>
    </tr>
    Code (markup):
    which will let you build up the email like this
    <?php
    $formcontent = "From: {$name}
    Site: {$site}";
    foreach($_POST['product'] as $k => $v){
    $val = intval($v);
       if ($val > 0) {
         $formcontent .= "\n{$label[$k]}: {$val}";
       }
    }
    Code (markup):
    However, if you did want to include all items in the email regardless of quantity ordered I'd recommend using a table and an html formatted email for readability.
     
    sarahk, Mar 15, 2017 IP
  3. webber09

    webber09 Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #3
    Hi SarahK

    Thanks for your help here :) I have implemented how you have suggested above where it drops the items if they are at 0... and there is now no error's and the email is sending... however I am not getting the labels through in the email - just the values they are set to.

    so for instance if i put
    Coca Cola 4
    Rio Riva Tropical 5
    Pepsi 1

    on the email it is showing as
    : 4
    : 5
    : 1

    Thanks again for your help
     
    webber09, Mar 16, 2017 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #4
    Well... really your mail shouldn't be showing much of anything other than the $ values since:

    ='From: $name \n Sit

    SINGLE QUOTE.... means $name would just show a literal $name, not the value of the variable.

    PICK a bloody linefeed type; you're mixing /r/n, /n, /n/n, PICK ONE... probably they should ALL be /r/n for maximum compatibility.

    STOP making variables for nothing; you want to use $_POST, use $_POST

    AUTOMATE the values. @sarahk was right in that doing name="product[DRK065]" would probably be FAR easier to deal with server-side since you could then simply have an associative array of product ID's and their names to parse through.

    Finally, whilst I WOULD be tempted to call that tabular data, that doesn't mean you should lack label tags or at least TH for each row... or your scope attributes. Likewise all those width and style declarations have ZERO place in modern markup.

    So... first thing I'd do is make a bloody ARRAY containing the product ID and title.

    
    $products = [
    	'DRK065' => 'Coca Cola',
    	'DRK631' => 'Rio Riva Tropical',
    	'DRL102' => 'Pepsi'
    	// etc, etc, etc
    ];
    
    Code (markup):
    This Array would be called by BOTH the form creation AND the form action.

    
    echo '
    	<form action="/send.php" method="post" id="products">
    		<fieldset>
    			<table>
    				<thead>
    					<tr>
    						<th scope="col">Product Discription</th>
    						<th scope="col">Product Number</th>
    						<th scope="col">Quantity Needed</th>
    					</tr>
    				</thead><tbody>';
    				
    foreach ($products as $code => $label) echo '
    					<tr>
    						<th scope="row">
    							<label for="products_', $code, '">
    								$label
    							</label>
    						</th>
    						<td>',$code,'</td>
    						<td>
    							<input
    								type="number"
    								name="product[', $code, ']"
    								id="product_', $code, '"
    								value="0"
    							>
    						</td>
    					</tr>';
    					
    echo '
    				</tbody>
    			</table>
    		</fieldset>
    	</form>';
    
    Code (markup):
    This simplifies creating your form body so that you can lose that ENDLESS freaking hord of variable for nothing asshattery and simply go:

    
    $formContent = 'From: ' . $name;
    foreach ($_POST['products'] as $code => $count)
    	if ($count > 0) $formContent .= "\r\n " . $products[$code] . ': ' . $count;
    
    Code (markup):
    STOP brute forcing every joe-blasted value! Also helps to properly form your form with fieldsets, labels, for attributes and ID's for those FOR to point at!.
     
    deathshadow, Mar 16, 2017 IP
    sarahk likes this.
  5. webber09

    webber09 Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #5
    Hi @deathshadow,

    Thanks for your input on this,

    So i have now made the variables at the top on my form page read:
    <?php
    $products = [
        'DRK065' => 'Coca Cola',
        'DRK631' => 'Rio Riva Tropical',
        'DRL102' => 'Pepsi'
    ];
    ?>
    PHP:
    I am just keeping it simple for now using the 3 products there. and the from itself is now:
    <?php
          echo '
        <form action="./send.php" method="post" id="products">
            <fieldset>
                <table border="1" width="100%">
                    <thead>
                        <tr>
                            <th scope="col">Product Discription</th>
                            <th scope="col">Product Number</th>
                            <th scope="col">Quantity Needed</th>
                        </tr>
                    </thead><tbody>';
                   
    foreach ($products as $code => $label) echo '
                        <tr>
                            <th scope="row">
                                <label for="products_', $code, '">
                                    ', $label, '
                                </label>
                            </th>
                            <td>',$code,'</td>
                            <td>
                                <input
                                    type="number"
                                    name="product[', $code, ']"
                                    id="product_', $code, '"
                                    value="0"
                                >
                            </td>
                        </tr>';
                       
    echo '
    <td colspan="2">Site Name:<br />
                  <input style="width:70%;" type="text" name="site" value="', $_SESSION['Username'] ,'" /></td>
                <td><input type="submit" name="submit" value="Submit" /></td>
              </tr>
                    </tbody>
                </table>
            </fieldset>
        </form>';?>
    PHP:
    this all displays correctly with each product code and id showing in the table. in the send.php file this is everything:
    <?php
    $site = ['site'];
    $products = [
        'DRK065' => 'Coca Cola',
        'DRK631' => 'Rio Riva Tropical',
        'DRL102' => 'Pepsi'
    ];
    $recipient="myemail@hotmail.co.uk";
    $subject = "Order Form Submitted";
    $formContent = 'From: ' . $site;
    foreach ($_POST['products'] as $code => $count)
        if ($count > 0) $formContent .= "\r\n " . $products[$code] . ': ' . $count;
    mail($recipient, $subject, $formcontent) or die("Error!");
    echo "Thank You!" . " -" . "<a href='http://mywebaddress.co.uk/staff/'>Return Home</a>";
    ?>
    PHP:
    when the email sends it sends okay (as in no errors actually sending, however the email is completely empty!

    Sorry for my stupidness here and i really appreciate your help!

    Thanks
     
    webber09, Mar 16, 2017 IP
  6. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #6
    I named the variable formContent, you have formcontent in your mail() function. PHP is case sensitive. (don't worry, easy mistake -- it's why I HATE case sensitive languages, case sensitive filesystems, and all sorts of other *nix asshattery)

    I would also suggest in production you keep the array in a separate file then include it from both, that way you can edit both from one location. Don't make multiple copies of the same thing for nothing... though in REAL production something like that would be pulled from a database.

    Oh, and your "from"/$site is gibberish... why are you making it an array?
     
    deathshadow, Mar 16, 2017 IP
  7. webber09

    webber09 Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #7
    @deathshadow i saw the $site issue once i posted this and slapped myself for that lol!

    I have now changed that c to a C and I am now getting 'From: admin' in my email... thats it (admin is my username btw... once live their username becomes site name)

    thanks
     
    webber09, Mar 16, 2017 IP
  8. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #8
    your problem is with

    <?php
    $site = ['site'];
    PHP:
    What variable is meant to be picked up because that's not going to return anything meaningful.
     
    sarahk, Mar 16, 2017 IP
  9. webber09

    webber09 Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #9
    its picking up the username which will be there site id - this line in the form

    <input style="width:70%;" type="text" name="site" value="', $_SESSION['Username'] ,'" />
    PHP:
    and this is now the php mailer -
    <?php
    $site = $_POST['site'];
    $products = [
        'DRK065' => 'Coca Cola',
        'DRK631' => 'Rio Riva Tropical',
        'DRL102' => 'Pepsi'
    ];
    $recipient="myemail@hotmail.co.uk";
    $subject = "Order Form Submitted";
    
    $formContent = 'From: ' . $site;
    foreach ($_POST['products'] as $code => $count)
        if ($count > 0) $formContent .= "\r\n " . $products[$code] . ': ' . $count;
       
    echo $recipient, $subject, $formContent /*or die("Error!")*/;
    echo "Thank You!" . " -" . "<a href='http://mywebaddress.co.uk/staff/'>Return Home</a>";
    ?>
    PHP:
    the mail IS sending and IS sending through the site id, but nothing else.

    Thanks again
     
    webber09, Mar 16, 2017 IP
  10. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #10
    if you do a var_dump() of $_POST['products'] does it have the content you expect?
     
    sarahk, Mar 16, 2017 IP
    deathshadow likes this.
  11. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #11
    That would be what I'd suggest checking too. Are the values even there?

    OOP, should be product, not products. Check what the markup code is outputting.... product[], not products[]
     
    Last edited by a moderator: Mar 16, 2017
    deathshadow, Mar 16, 2017 IP
  12. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #12
    those pesky extra characters!
     
    sarahk, Mar 16, 2017 IP
  13. webber09

    webber09 Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #13
    Hi guys,

    Thanks for sticking with me through this!!

    So i have put this in the email send - var_dump($_POST['product']); and it shows all it shows is "NULL"
     
    webber09, Mar 17, 2017 IP
  14. webber09

    webber09 Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #14
    Wait wait wait... scratch that... i dont know what i have done but it bloody works!! sends email... everything :D

    I dont know what the heck i changed/did but its working!!

    Thank you so much guys... it is most appreciated
     
    webber09, Mar 17, 2017 IP