Results 1 to 3 of 3

Thread: Can't get 3 text fields to work

  1. #1
    Join Date
    Oct 2007
    Posts
    46
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Can't get 3 text fields to work

    First off, I'm confessing that I'm a designer and have very limited programming skills. I actually don't know php. I had help from a programmer for this website http://technocranecanada.com/. She's no longer doing this sort of work so I'm feeling a bit stuck. There is a jobsheet which can be viewed at http://technocranecanada.com/jobshee...html&URL=Enter

    The client wanted 3 new text fields added:

    Driver In
    Driver Out
    Transport Coordinator

    I've added these fields and made some adjustments to the html and the php based on what was done in the past. For some reason though, the 3 new fields are not working. Here's what I've got for html:

    <code> if (validate_text(driverin,"Please enter Driver In")==false)
    {driverin.focus();return false;}
    if (validate_text(driverout,"Please enter Driver Out")==false)
    {driverout.focus();return false;}
    if (validate_text(transportcoordinator,"Please enter Transport Coordinator")==false)
    {transportcoordinator.focus();return false;}
    </code>

    And here is the php:
    <code>
    <?php
    // Check referer - I think this is how this is happening... needs to be coming from jobsheetnew
    if(stristr($_SERVER["HTTP_REFERER"],'jobsheetnew.html') === false) {
    //redirect to the home page
    header( 'Location: /index.html');
    /* Make sure that code below does not get executed when we redirect. */
    exit;
    }
    $tc = $_POST['tc'];
    $date = $_POST['date'];
    $production = $_POST['production'];
    $technotech1 = $_POST['technotech1'];
    $technotech2 = $_POST['technotech2'];
    $remotehead = $_POST['remotehead'];
    $remotetech = $_POST['remotetech'];
    $calltime = $_POST['calltime'];
    $wrap = $_POST['wrap'];

    $email = $_POST['email'];
    $pm = $_POST['pm'];
    $director = $_POST['director'];
    $shootingaddress = $_POST['shootingaddress'];
    $keygrip = $_POST['keygrip'];
    $dollygrip = $_POST['dollygrip'];
    $dop = $_POST['dop'];
    $cameraoperator = $_POST['cameraoperator'];

    $track = $_POST['track'];
    $cameracar = $_POST['cameracar'];
    $supernova = $_POST['supernova'];

    $requirements = $_POST['requirements'];
    $notes = $_POST['notes'];
    $additionalinfo = $_POST['additionalinfo'];

    $cleanwrap = $_POST['cleanwrap'];


    //Process tc
    switch ($tc) {
    case "tc_1":
    $actual_tc = "TC #1 ST30 (Vancouver)";
    break;
    case "tc_2":
    $actual_tc = "TC #2 ST30 (LALA)";
    break;
    case "tc_3":
    $actual_tc = "TC #3 ST30 (93)";
    break;
    case "tc_4":
    $actual_tc = "TC #4 ST30 (94)";
    break;
    case "tc_5":
    $actual_tc = "TC #5 T20";
    break;
    case "tc_6":
    $actual_tc = "TC #6 T15";
    break;
    case "tc_7":
    $actual_tc = "TC#7 ST50 (212)";
    break;
    case "tc_8":
    $actual_tc = "TC #8 T20 (UK)";
    break;
    case "tc_9":
    $actual_tc = "TC#9 ST30 (81)";
    break;
    case "tc_10":
    $actual_tc = "TC#10 ST30 (163)";
    break;
    case "tc_11":
    $actual_tc = "TC#11 ST50 (230)";
    break;
    case "tc_12":
    $actual_tc = "TC#12 Technodolly (186)";
    break;
    case "tc_14":
    $actual_tc = "TC#14 ST30 Toronto (270)";
    break;
    case "tc_15":
    $actual_tc = "TC#15 ST50 (263)";
    break;
    }
    // Check for an empty form first - need to do this in case javascript is turned off!
    $error = false;
    if ($_POST['date']=="") $error = true;
    elseif ($_POST['production']=="") $error = true;
    elseif ($_POST['technotech1']=="") $error = true;
    elseif ($_POST['technotech2']=="") $error = true;
    elseif ($_POST['remotehead']=="") $error = true;
    elseif ($_POST['remotetech']=="") $error = true;
    elseif ($_POST['calltime']=="") $error = true;
    elseif ($_POST['wrap']=="") $error = true;
    elseif ($_POST['email']=="") $error = true;
    elseif ($_POST['pm']=="") $error = true;
    elseif ($_POST['director']=="") $error = true;
    elseif ($_POST['shootingaddress']=="") $error = true;
    elseif ($_POST['keygrip']=="") $error = true;
    elseif ($_POST['dollygrip']=="") $error = true;
    elseif ($_POST['dop']=="") $error = true;
    elseif ($_POST['cameraoperator']=="") $error = true;
    elseif ($_POST['driverin']=="") $error = true;
    elseif ($_POST['driverout']=="") $error = true;
    elseif ($_POST['transportcoordinator']=="") $error = true;
    if ($error === true) {
    //redirect back to the form
    header( 'Location: /jobsheetnew.html');
    exit;
    }
    $body = "
    Email: $email \n
    Date: $date \n
    Crane Worked: $actual_tc \n
    Production: $production \n
    TechnoTech1: $technotech1 \n
    TechnoTech2: $technotech2 \n
    Remote Head: $remotehead \n
    Remote Tech: $remotetech \n
    Call Time: $calltime \n
    Wrap: $wrap \n\n

    PM: $pm \n
    Director: $director \n
    Shooting Address: $shootingaddress \n
    Key Grip: $keygrip \n
    Dolly Grip: $dollygrip \n
    DOP: $dop \n
    Camera Operator: $cameraoperator \n
    Driver In: $driverin \n
    Driver Out: $driverout \n
    Transport Coordinator: $transportcoordinator \n\n

    Track: $track \n
    On camera car: $cameracar \n
    On Super Nova: $supernova \n\n

    Special Requirements: \n
    $requirements \n\n
    Notes: \n
    $notes \n\n
    Additional Information: \n
    $additionalinfo \n
    Clean&Wrap: $cleanwrap
    ";


    echo "Thank you!<br>";
    echo "Your jobsheet has been submitted.";

    $to = 'johnsp@shaw.ca,liberty@technocranecanada.com,andrew@technocranecanada.com,technojobsheets@shaw.ca,technocranecanada@hotmail.com';
    $su = "Jobsheet from $email";
    $header = "From: $email";

    mail ($to,$su,$body,$header);

    //send copy of crane wrap sheet to originator
    $to = $email;
    $su = "Copy of jobsheet entered: ".$date;
    $header = "From: $email";
    mail ($to,$su,$body,$header);
    ?>
    </code>

    I'm at a loss as to what is missing. Thanks in advance for any offers to help.

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    What you posted for html is not html that is javascript and incomplete, or incorrect.

    This part is setting variables from the input of the user. You need to add in the driverin and other variables around here, or before where you call $driverin etc. I've post a sample at the bottom of how it could look.

    PHP Code:
    $tc $_POST['tc'];
    $date $_POST['date'];
    $production $_POST['production'];
    $technotech1 $_POST['technotech1'];
    $technotech2 $_POST['technotech2'];
    $remotehead $_POST['remotehead'];
    $remotetech $_POST['remotetech'];
    $calltime $_POST['calltime'];
    $wrap $_POST['wrap'];

    $email $_POST['email'];
    $pm $_POST['pm'];
    $director $_POST['director'];
    $shootingaddress $_POST['shootingaddress'];
    $keygrip $_POST['keygrip'];
    $dollygrip $_POST['dollygrip'];
    $dop $_POST['dop'];
    $cameraoperator $_POST['cameraoperator'];

    $track $_POST['track'];
    $cameracar $_POST['cameracar'];
    $supernova $_POST['supernova'];

    $requirements $_POST['requirements'];
    $notes $_POST['notes'];
    $additionalinfo $_POST['additionalinfo'];

    $cleanwrap $_POST['cleanwrap']; 
    FOR EXAMPLE
    PHP Code:
    $driverin $_POST['driverin'];
    $driverout $_POST['driverout'];
    $transportcoordinator $_POST['transportcoordinator']; 
    The coding blocks also blocked by using [ code ] no spaces and [ /code ]
    or if php [ PHP ] and [ /PHP ].
    Corrections to my coding/thoughts welcome.

  3. The Following User Says Thank You to bluewalrus For This Useful Post:

    ozzie123 (10-20-2010)

  4. #3
    Join Date
    Oct 2007
    Posts
    46
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Thank you, thank you, thank you Blue Walrus! It works!!!

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
  •