php/sendmail help!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I have a form, form results are PUSHED to another page and processed.  Files below. (in plain-tet)
   
  Now this is what I want to do:
   
  1) Make all fields required input, but if easy to configure I want to have rules for each textarea.  For instance an email address must contain a '@' symbol.  Must be at leat 5 character longs and must be in a form of an email address.  So if I type you@me it would produce an error, highlighting the error area or display a message at the top of the page.  Postcode should contain 4 numbers and numbers only, etc.  The only field that can be left blank will be the message area.  How do I achieve this? (message regarding this below)
   
  2) I want to add to the form a UNIQUE ID generater.  I will add a new hidden form field for this.  I need a script called by PHP to generate it.  Would include both letters and numbers and be atleast 8 CHARS long.
   
  As for 1) I have tried some javascript but it failed, since I PUSH all field responses to another page.  When i add it the submit button fails and does not push the results through.  But it produces the error fine, but form is not PUSHED on.  So it seems it's lost because of the javascript.  So i took it out completely.  I think there is a way in PHP to call errors for forms?  But anways, here are the files below.  Please help, I am on a tight schedule here if anyone can assist me.
   
  file one looks like this: (form.php)
   
  <? include("header.php");?>
  <table width="800" border="0">
  <tr>
    <td width="270" valign="top"><? include("menu.php");?></td>
    <td width="500" valign="center">
  <DIV ALIGN=JUSTIFY>
  <? include("ads.php");?>
  <h1><b>Pre Order Form!</h1></b>
  <TABLE  WIDTH="90%" ALIGN="left" CELLSPACING="1" CELLPADDING="4" BORDER="0">
    <FORM ACTION=contact1.php METHOD=POST> 
<font face="arial">
<tr><td>First Name:</td> <td><INPUT TYPE="text" NAME="firstname" SIZE="25" MAXLENGTH="20"></td></tr><BR><B><tr><td>
Last Name:</td></B><td><INPUT TYPE="text" NAME="lastname" SIZE="25" MAXLENGTH="25"></td></tr><B><tr><td>
<B><tr><td>Company:</td></B><td><INPUT TYPE="text" NAME="company" SIZE="25" MAXLENGTH="25"></td></tr><BR><B><tr><td>
Unit/House #:</td></B><td><INPUT TYPE="text" NAME="address1" SIZE="25" MAXLENGTH="6"></td></tr><BR><B><tr><td>
Street Name:</td></B><td><INPUT TYPE="text" NAME="address2" SIZE="25" MAXLENGTH="25"></td></tr><BR><B><tr><td>
Suburb/Town:</td></B><td><INPUT TYPE="text" NAME="suburb" SIZE="25" MAXLENGTH="25"></td></tr><BR><B><tr><td>
Post Code/Zip:</td></B><td><INPUT TYPE="text" NAME="postcode" SIZE="25" MAXLENGTH="25"></td></tr><BR><B><tr><td>
Phone #:</td></B><td><INPUT TYPE="text" NAME="phone" SIZE="25" MAXLENGTH="25"></td></tr><BR><B><tr><td>
Email Address:</td></B><td><INPUT TYPE="text" NAME="emailaddress" SIZE="25" MAXLENGTH="25"></td></tr><BR><B><tr><td></td></B><td> </td></tr><BR><B><tr><td>Country:</td></B><td><SELECT NAME="country" SIZE="1"><OPTION SELECTED>AUSTRALIA<OPTION>NEW ZEALAND<OPTION>FIJI<OPTION>UNITED KINGDOM<OPTION>GERMANY<OPTION>SWEDEN<OPTION>CANADA<OPTION>-----------------<OPTION>AFGHANISTAN<OPTION>ALBANIA<OPTION>ALGERIA<OPTION>AMERICAN SAMOA<OPTION>ANDORRA<OPTION>ANGOLA<OPTION>ANGUILLA<OPTION>ANTARCTICA<OPTION>ANTIGUA AND BARBUDA<OPTION>ARGENTINA<OPTION>ARMENIA<OPTION>ARUBA<OPTION>AUSTRIA<OPTION>AZERBAIJAN<OPTION>BAHAMAS<OPTION>BAHRAIN<OPTION>BANGLADESH<OPTION>BARBADOS<OPTION>BELARUS<OPTION>BELGIUM<OPTION>BELIZE<OPTION>BENIN<OPTION>BERMUDA<OPTION>BHUTAN<OPTION>BOLIVIA<OPTION>BOSNIA AND HERZEGOWINA<OPTION>BOTSWANA<OPTION>BOUVET ISLAND<OPTION>BRAZIL<OPTION>BRITISH INDIAN OCEAN TERRITORY<OPTION>BRUNEI DARUSSALAM<OPTION>BULGARIA<OPTION>BURKINA
 FASO<OPTION>BURUNDI<OPTION>CAMBODIA<OPTION>CAMEROON<OPTION>CANADA<OPTION>CAPE VERDE<OPTION>CAYMAN ISLANDS<OPTION>CENTRAL AFRICAN REPUBLIC<OPTION>CHAD<OPTION>CHILE<OPTION>CHINA<OPTION>CHRISTMAS ISLAND<OPTION>COCOS (KEELING) ISLANDS<OPTION>COLOMBIA<OPTION>COMOROS<OPTION>CONGO<OPTION>COOK ISLANDS<OPTION>COSTA RICA<OPTION>COTE D'IVOIRE<OPTION>CROATIA (local name: Hrvatska)<OPTION>CUBA<OPTION>CYPRUS<OPTION>CZECH REPUBLIC<OPTION>DENMARK<OPTION>DJIBOUTI<OPTION>DOMINICA<OPTION>DOMINICAN REPUBLIC<OPTION>EAST TIMOR<OPTION>ECUADOR<OPTION>EGYPT<OPTION>EL SALVADOR<OPTION>EQUATORIAL GUINEA<OPTION>ERITREA<OPTION>ESTONIA<OPTION>ETHIOPIA<OPTION>FALKLAND ISLANDS (MALVINAS)<OPTION>FAROE ISLANDS<OPTION>FIJI<OPTION>FINLAND<OPTION>FRANCE<OPTION>FRANCE, METROPOLITAN<OPTION>FRENCH GUIANA<OPTION>FRENCH POLYNESIA<OPTION>FRENCH
 OTHER<OPTION>GABON<OPTION>GAMBIA<OPTION>GEORGIA<OPTION>GERMANY<OPTION>GHANA<OPTION>GIBRALTAR<OPTION>GREECE<OPTION>GREENLAND<OPTION>GRENADA<OPTION>GUADELOUPE<OPTION>GUAM<OPTION>GUATEMALA<OPTION>GUINEA<OPTION>GUINEA-BISSAU<OPTION>GUYANA<OPTION>HAITI<OPTION>HEARD AND MC DONALD ISLANDS<OPTION>HONDURAS<OPTION>HONG KONG<OPTION>HUNGARY<OPTION>ICELAND<OPTION>INDIA<OPTION>INDONESIA<OPTION>IRAN (ISLAMIC REPUBLIC OF)<OPTION>IRAQ<OPTION>IRELAND<OPTION>ISRAEL<OPTION>ITALY<OPTION>JAMAICA<OPTION>JAPAN<OPTION>JORDAN<OPTION>KAZAKHSTAN<OPTION>KENYA<OPTION>KIRIBATI<OPTION>KOREA<OPTION>KUWAIT<OPTION>KYRGYZSTAN<OPTION>LATVIA<OPTION>LEBANON<OPTION>LESOTHO<OPTION>LIBERIA<OPTION>LIBYAN ARAB JAMAHIRIYA<OPTION>LIECHTENSTEIN<OPTION>LITHUANIA<OPTION>LOCATION NOT REPORTED<OPTION>LUXEMBOURG<OPTION>MACAU<OPTION>MACEDONIA<OPTION>MADAGASCAR<OPTION>MALAWI<OPTION>MALAYSIA<OPTION>MALDIVES<OPTION>MALI<OPTION>MALTA<OPTION>MARSHALL
 ISLANDS<OPTION>MARTINIQUE<OPTION>MAURITANIA<OPTION>MAURITIUS<OPTION>MAYOTTE<OPTION>MEXICO<OPTION>MICRONESIA<OPTION>MOLDOVA, REPUBLIC OF<OPTION>MONACO<OPTION>MONGOLIA<OPTION>MONTSERRAT<OPTION>MOROCCO<OPTION>MOZAMBIQUE<OPTION>MYANMAR<OPTION>NAMIBIA<OPTION>NAURU<OPTION>NEPAL<OPTION>NETHERLANDS<OPTION>NETHERLANDS ANTILLES<OPTION>NEW CALEDONIA<OPTION>NEW ZEALAND<OPTION>NICARAGUA<OPTION>NIGER<OPTION>NIGERIA<OPTION>NIUE<OPTION>NORFOLK ISLAND<OPTION>NORTHERN MARIANA ISLANDS<OPTION>NORWAY<OPTION>Not Available<OPTION>OMAN<OPTION>PAKISTAN<OPTION>PALAU<OPTION>PANAMA<OPTION>PAPUA NEW GUINEA<OPTION>PARAGUAY<OPTION>PERU<OPTION>PHILIPPINES<OPTION>PITCAIRN<OPTION>POLAND<OPTION>PORTUGAL<OPTION>PUERTO RICO<OPTION>QATAR<OPTION>REUNION<OPTION>ROMANIA<OPTION>RUSSIAN FEDERATION<OPTION>RWANDA<OPTION>SAINT KITTS AND NEVIS<OPTION>SAINT LUCIA<OPTION>SAINT VINCENT<OPTION>SAMOA<OPTION>SAN MARINO<OPTION>SAO TOME AND PRINCIPE<OPTION>SAUDI ARABIA<OPTION>SENEGAL<OPTION>SEYCHELLES<OPTION>SIERRA
 LEONE<OPTION>SINGAPORE<OPTION>SLOVAKIA (Slovak Republic)<OPTION>SLOVENIA<OPTION>SOLOMON ISLANDS<OPTION>SOMALIA<OPTION>SOUTH AFRICA<OPTION>SOUTH GEORGIA <OPTION>SPAIN<OPTION>SRI LANKA<OPTION>ST. HELENA<OPTION>ST. PIERRE AND MIQUELON<OPTION>SUDAN<OPTION>SURINAME<OPTION>SWAZILAND<OPTION>SWEDEN<OPTION>SWITZERLAND<OPTION>SYRIAN ARAB REPUBLIC<OPTION>TAIWAN, PROVINCE OF CHINA<OPTION>TAJIKISTAN<OPTION>TANZANIA, UNITED REPUBLIC OF<OPTION>THAILAND<OPTION>TOGO<OPTION>TOKELAU<OPTION>TONGA<OPTION>TRINIDAD AND TOBAGO<OPTION>TUNISIA<OPTION>TURKEY<OPTION>TURKMENISTAN<OPTION>TURKS AND CAICOS ISLANDS<OPTION>TUVALU<OPTION>UGANDA<OPTION>UKRAINE<OPTION>UNITED ARAB EMIRATES<OPTION>UNITED KINGDOM<OPTION>UNITED STATES<OPTION>UNITED STATES MINOR<OPTION>UNKNOWN LOCATION<OPTION>URUGUAY<OPTION>UZBEKISTAN<OPTION>VANUATU<OPTION>VATICAN CITY STATE (HOLY SEE)<OPTION>VENEZUELA<OPTION>VIET NAM<OPTION>VIRGIN ISLANDS (BRITISH)<OPTION>VIRGIN ISLANDS (U.S.)<OPTION>WALLIS AND FUTUNA ISLANDS<OPTION>WESTERN
 SAHARA<OPTION>YEMEN<OPTION>ZAMBIA<OPTION>ZIMBABWE</SELECT></td></tr><tr><td>Message: </td>
<td><textarea name="order_message" rows="10" cols="40">
</textarea></td></tr>
<tr><td></td><td>
        <INPUT TYPE=SUBMIT VALUE="Buy Now"> 
    </FORM>
  <? include("copyright.php");?>
</DIV>
 
</tr>
</table>
</td>
  </tr>
</table>
</font>
</body>
</html>

   
  
--end--
   
  here is file 2: resultsubmit.php
   
  <? include("header.php");?>
  <table width="612" border="0">
  <tr>
    <td width="270" valign="top"><? include("menu.php");?></td>
    <td width="344" valign="top">
  <DIV ALIGN=JUSTIFY>
  <? include("ads.php");?>
  <?php 
      $to = 'email@xxxxxxxxxx'; 
      $from = 'local@localhost'; 
       
        //Check if we have something POSTed by the form. 
        if (isset($HTTP_POST_VARS)){ 
            //Start with an empty body for the mail message 
            $body = ''; 
            //Iterate through all the POSTed variables, and add them to the message body. 
            while (list($key, $value) = each($HTTP_POST_VARS)){ 
                $body .= $key . ' = ' . $value . "
 "; 
            } 
            //Build up some nice From/Reply Headers 
            $headers = "From: $from"; 
            //Mail the message out. 
            //Requires setting php3.ini sendmail path as per instructions 
            $success = mail($to, "Posted " . date("m/d/Y"), $body, $headers); 
            //Always check return codes from functions. 
            if ($success){ 
                echo "<B><CENTER>Please wait... Your request is being processed...!</CENTER></B>"; 
            } 
            else{ 
                echo "<CENTER><B>Internal Error</B>:  Your input was unprocessed.<BR>Contact $from</CENTER>"; 
            } 
        } 
    ?> 
</DIV>
  </td>
  </tr>
</table>
  </body>
</html>
   
  --end--
   
   
  FYI I have changed some email settings and configuration files for security reasons.  But as you can see results are pushed to the second file than emailed off, no need for a database or anything.  So you should be able to test very easily.
   
  If anyone can help with suggestions or even do the code it would be mostly appreciated, can pay since it's urgent.
   
  Thanks for your time!
   
  J



**********************************************************************

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.

************************************************************************
<<<<GWAVAsig>>>>
AdmID:6A8A36263EAF13571ADE265906F0171E



**********************************************************************

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.

************************************************************************
<<<<GWAVAsig>>>>
-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux