Results 1 to 3 of 3

Thread: Modified Form Tutorial

  1. #1

    Modified Form Tutorial

    This modified form tutorial keeps dropping to the "else" statement, meaning that it failed. Blarg!

    What am I missing?


    mailer.php


    <?php
    if(isset($_POST['submit'])) {
    $to = "bobo.scottberry@gmail.com";
    $subject = "IEX Exception";
    $name_field = $_POST['name'];
    $starthr = $_POST['starthr'];
    $startmin = $_POST['startmin'];
    $starttime = $_POST['starttime'];

    $stophr = $_POST['stophr'];
    $stopmin = $_POST['stopmin'];
    $stoptime = $_POST['stoptime'];
    $status = $_POST['status'];
    $reason = $_POST['reason'];


    $body = "$name_field \n Start Time: $starthr : $startmin $starttime \n Stop Time: $stophr : $stopmin $stoptime \n Status: $status \n Reason: $reason \n" ;
    echo "Exception has been successfully submitted to supervisor and lead.";
    mail($to, $subject, $body);

    } else {
    echo "blarg!";
    }
    ?>



    contact.htm



    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>IEX Exception</title>
    </head>
    <body>
    <font face="verdana">
    <form method="POST" action="mailer.php">

    <br><br>
    Name:
    <input type="text" name="name" size="19"><br>

    <br>
    Time:
    <br><br>
    Start:
    <select size="1" name="starthr">
    <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>
    </select>:
    <select size="1" name="startmin">
    <option>00</option>
    <option>05</option>
    <option>10</option>
    <option>15</option>
    <option>20</option>
    <option>25</option>
    <option>30</option>
    <option>35</option>
    <option>40</option>
    <option>45</option>
    <option>50</option>
    <option>55</option>
    </select>
    <input type="radio" value="AM" name="starttime">AM
    <input type="radio" value="PM" name="starttime">PM

    <br>
    <br>
    Stop:
    <select size="1" name="stophr">
    <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>
    </select>:
    <select size="1" name="stopmin">
    <option>00</option>
    <option>05</option>
    <option>10</option>
    <option>15</option>
    <option>20</option>
    <option>25</option>
    <option>30</option>
    <option>35</option>
    <option>40</option>
    <option>45</option>
    <option>50</option>
    <option>55</option>
    </select>

    <input type="radio" value="AM" name="stoptime">AM
    <input type="radio" value="PM" name="stoptime">PM
    <br><br><br>
    Status:
    <select size="1" name="status">
    <option>Assigned Special Project</option>
    <option>At Meeting</option>
    <option>At Training</option>
    </select><br><br>
    <br>
    Reason:<br>
    <textarea rows="4" name="reason" cols="30"></textarea><br>
    <br>
    <input type="submit" value="Submit" name="Submit">
    </form>

    </body>
    </html>

  2. #2
    It should be isset($_POST['Submit']) with capital S since you have <input type="submit" value="Submit"

  3. #3
    Quote Originally Posted by prasanthmj View Post
    It should be isset($_POST['Submit']) with capital S since you have <input type="submit" value="Submit"
    This is 50% right. Yes it should be
    PHP Code:
    isset($_POST['Submit']) 
    but not because you have

    HTML Code:
    <input type="submit" value="Submit"
    it's because you have

    HTML Code:
    <input type="submit" value="Submit" name="Submit" />
    the important factor here is that it's the name value that determines what goes inside the $_POST
    Let us live so that when we come to die even the undertaker will be sorry. - Mark Twain
    Don't PM me your CSS, xHTML, JS or PHP questions. I will not reply to ANY IE6 questions.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012