Html Form Problem..

Discussion in 'Gaming' started by Reflection-X13, Sep 17, 2005.

  1. LemoNade

    LemoNade Well-Known Member

    Age:
    37
    Posts:
    500
    Likes Received:
    0
    Joined:
    Dec 21, 2004
    Location:
    Southampton, England
    For £5 I will code you a fully-customisable PHP-Contact Form, so its sends you all the information from the form to your inbox without the use of mailto:

    :)
     
  2. XxLostXx

    XxLostXx Well-Known Member

    Age:
    34
    Posts:
    803
    Likes Received:
    0
    Joined:
    Aug 22, 2005
    Location:
    homeless
    I could send you the two files so it sends to your email. First you you open a formmail.php file and all you do is edit the subject, then upload that to your server and in you're actual form you change the action to action="http://www.yourdomain.com/formmail.php" blah..... and thats it.
     
  3. Reflection-X13

    Reflection-X13 Well-Known Member

    Posts:
    480
    Likes Received:
    0
    Joined:
    Aug 16, 2005
    This is the php code that i gathered from a tutorial and customized to my needs..

    Contents of formmail.php
    Code:
    <?
    $mailto = '[email protected]';
    $subject = "Burlington County All-Star Basketball Camp Registration";
    
    $formurl = "register.html";
    $errorurl = "error.html";
    $thankyouurl = "thankyou.html";
    
    $name = $_POST['name'];
    $address = $_POST['address'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $zip = $_POST['zip'];
    $phone = $_POST['phone'];
    $dayphone = $_POST['dayphone'];
    $fax = $_POST['fax'];
    $age = $_POST['age'];
    $height = $_POST['height'];
    $weight = $_POST['weight'];
    $school = $_POST['school'];
    $coach = $_POST['coach'];
    $position = $_POST['position'];
    $gender = $_POST['gender'];
    $month = $_POST['bday_month'];
    $day = $_POST['bday_day'];
    $year = $_POST['year'];
    $parentname = $_POST['parent'];
    $weeks = $_POST['weeks'];
    
    if (empty($fax)) {
    $fax = "none";
    }
    
    $http_referrer = getenv( "HTTP_REFERER" );
    
    if (!isset($_POST['email'])) {
    header( "Location: $formurl" );
    exit;
    }
    
    if (empty($name) || empty($address) || empty($city) || empty($state) || empty($zip) || empty($phone) || empty($dayphone) || empty($age) || empty($weight) || empty($height) || empty($school) || empty($coach) || empty($position) || empty($gender) || empty($month) || empty($day) || empty($year) || empty($parentname) || empty($weeks)) {
    header( "Location: $errorurl" );
    exit;
    }
    
    $messageproper =
    
    "Camper name: $name\n" .
    "Address: $address\n" .
    "City: $city\n" .
    "State: $state\n" .
    "Zip Code: $zip\n" .
    "Home Phone: $phone\n" .
    "Parent Day Phone: $dayphone\n" .
    "Fax: $fax\n" .
    "Age at Camp: $age\n" .
    "Weight: $weight\n" .
    "Height: $height\n" .
    "School: $school\n" .
    "Coach Name: $coach\n" .
    "Position Played: $position\n" .
    "Gender: $gender\n" .
    "Birthday: $month $day, $year\n" .
    "Parent: $parentname\n\n" .
    "1 = week 1, 2 = week 2 etc..\n" .
    "Weeks Attending: $weeks\n";
    
    mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\nReply-To: \"$name\" <$email>\nX-Mailer: chfeedback.php 2.01" );
    if(mail){
    header( "Location: $thankyouurl" );
    exit;
    }
    
    ?>
    
    The html code of register.html is
    Code:
    <form method="POST" action="formmail.php" ENCTYPE="text/plain"> 
    
    <font size="3">[b][u]Camper Information[/u][/b]</font>
     
    Name: <INPUT TYPE="text" Name="name" SIZE="30">
     
    Address: <INPUT TYPE="text" Name="address" SIZE="55">
     
    City: <INPUT TYPE="text" Name="city" SIZE="25"> State: <INPUT TYPE="text" Name="state" SIZE="2"> Zip Code: <INPUT TYPE="text" Name="zip" SIZE="5">
     
    Home Telephone(no dashes): <INPUT TYPE="text" Name="phone" SIZE="10">
     
    Parent Daytime Telephone(no dashes): <INPUT TYPE="text" Name="dayphone" SIZE="10">
     
    Fax(optional): <INPUT TYPE="text" Name="fax" SIZE="10">
     
    Age At Camp: <INPUT TYPE="text" Name="age" SIZE="2"> Height(i.e. 5'0"): <INPUT TYPE="text" Name="height" SIZE="4"> Weight(lbs.): <INPUT TYPE="text" Name="weight" SIZE="3">
     
    School: <INPUT TYPE="text" Name="school" SIZE="50">
     
    Coach: <INPUT TYPE="text" Name="coach" SIZE="50">
     
    Position: <INPUT TYPE="text" Name="position" SIZE="50">
     
    Gender: <INPUT TYPE="text" Name="gender" size="1">
     
    Birthdate: Month 
    <SELECT Name="bday_Month" SIZE="1"> 
    <OPTION SELECTED>January</OPTION> 
    <OPTION>February</OPTION> 
    <OPTION>March</OPTION> 
    <OPTION>April</OPTION> 
    <OPTION>May</OPTION> 
    <OPTION>June</OPTION> 
    <OPTION>July</OPTION> 
    <OPTION>August</OPTION> 
    <OPTION>September</OPTION> 
    <OPTION>October</OPTION> 
    <OPTION>November</OPTION> 
    <OPTION>December</OPTION> 
    </SELECT> 
    Day 
    <SELECT Name="bday_day" SIZE="1"> 
    <OPTION>1</OPTION> 
    <OPTION>2</OPTION> 
    <OPTION>3</OPTION> 
    <OPTION>4</OPTION> 
    <OPTION>5</OPTION> 
    <OPTION>6</OPTION> 
    <OPTION>7</OPTION> 
    <OPTION>8</OPTION> 
    <OPTION>9</OPTION> 
    <OPTION>10</OPTION> 
    <OPTION>11</OPTION> 
    <OPTION>12</OPTION> 
    <OPTION>13</OPTION> 
    <OPTION>14</OPTION> 
    <OPTION>15</OPTION> 
    <OPTION>16</OPTION> 
    <OPTION>17</OPTION> 
    <OPTION>18</OPTION> 
    <OPTION>19</OPTION> 
    <OPTION>20</OPTION> 
    <OPTION>21</OPTION> 
    <OPTION>22</OPTION> 
    <OPTION>23</OPTION> 
    <OPTION>24</OPTION> 
    <OPTION>25</OPTION> 
    <OPTION>26</OPTION> 
    <OPTION>27</OPTION> 
    <OPTION>28</OPTION> 
    <OPTION>29</OPTION> 
    <OPTION>30</OPTION> 
    <OPTION>31</OPTION> 
    </SELECT> 
    Year: <INPUT TYPE="text" Name="year" SIZE="4">
     
    Parent Name: <INPUT TYPE="text" Name="parent" SIZE="50">
    
     
    
    <font size="3">[b][u]Package[/u][/b]</font>
     
    [b]Please Choose (You may choose more than one):[/b]
     
    1. July 25 - 29, 2006 at Holy Cross Highschool....$150.00
     
    2. August 1 - 5, 2006 at Holy Cross Highschool....$150.00
     
    3. July 25 - 29, 2006 at Burlington Township....$150.00
     
    4. Insurance - per week....$5.00
    
     
    Place numbers here: <Input type="text" Name="weeks" size="20">
     
    
    After submitting this form, please send in the medical form along with a non-refundable deposit of:
     
    <center><font size="3">[b] 
    $95.00 deposit for 1 week
     
    $135.00 deposit for 2 weeks
     
    $180.00 deposit for 3 week
    
     
    
    Enroll 2 weeks.......Take $15.00 off of total
     
    Enroll 3 weeks.......Take $30.00 off of total
    
    [/b]</font> 
    
    [b]Make checks payable to:
    [/b] 
    Ken Faulkner Basketball, Inc.
     
    901 Second Street
     
    Delanco, New Jersey 08057
    
     
    <font size="2">[b][u]IMPORTANT: Balance is due on or before July 1st, 2006[/u][/b]
    
    </font> 
    
    For Further Information call:
     
    [b]856-461-8805
     
    856-461-1577 (Fax)[/b]
    
    
     
    
    <INPUT TYPE="submit" Name="Submit Registration"> 
    <INPUT TYPE="reset"> 
    </center> 
    
    
    </form> 
    My problem is that when i click the submit button with info/all empty spaces, it just refreshes the form page. It doesn't take me to the thank you page or the error page (respectively). See anything wrong with the code?
     
  4. Gothic Surge

    Gothic Surge Well-Known Member

    Age:
    38
    Posts:
    3,357
    Likes Received:
    0
    Joined:
    Jun 1, 2005
    Dang man you just can't get the codes right lol...i'll look at it when i get back from work
     
  5. Reflection-X13

    Reflection-X13 Well-Known Member

    Posts:
    480
    Likes Received:
    0
    Joined:
    Aug 16, 2005
    yea..its frustrating..and this project is due tomorrow for my client.
     

Share This Page