I have a contact form that is being submitted, I have PHP validation all set up before it sends the email, however, I have 2 fields that are **dynamically** disabled or enabled based on the link clicked to get to the contact form. 

I need to know how to determine whether they are disabled or not and then validate them only if they're not disabled. 

Here's part of my form:

```
<label for="name">Name</label><br />
<input type="text" name="name" id="name" />

<label for="email">Email</label><br />
<input type="text" name="email" id="email" />

<label for="number">Phone Number</label><br />
<input type="text" name="number" id="number" />

<div id="date-time">
    <label for="date">Date</label><br />
    <input type="text" name="date" id="date" <?php
        if (!isset($_GET["appt"])==true) echo('disabled="disabled"'); ?> />

    <label for="time">Time</label><br />
    <input type="text" name="time" id="time" <?php
        if (!isset($_GET["appt"])==true) echo('disabled="disabled"'); ?> />
</div>

```

Here's part of my `mail.php` file (disregard the `cookie` functions):

```
    $name   = trim($_POST["name"]);
    $email  = trim($_POST["email"]);
    $phone  = trim($_POST["phone"]);
    $date   = trim($_POST["date"]);
    $time   = trim($_POST["time"]);

//Check to make sure that the name field is not empty
    if($name == NULL) {
        $hasError = true;
        $emailSent = false;
        cookie("hasError", "true");
        cookie("nameError", "true");
    } else {
        $name = $name;
    }

//Check to make sure sure that a valid email address is submitted
    if($email == NULL) {
        $hasError = true;
        $emailSent = false;
        cookie("hasError", "true");
        cookie("emailError", "true");
    } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", $email)) {
        $hasError = true;
        $emailSent = false;
        cookie("hasError", "true");
        cookie("emailError", "true");
    } else {
        $email = $email;
    }

//Check to make sure that the phone field is not empty
    if($phone == '' || $phone < 10) {
        $hasError = true;
        $emailSent = false;
        cookie("hasError", "true");
        cookie("phoneError", "true");
    } else {
        $phone = $phone;
    }

//Check to make sure that the date field is not empty
    if($date == '') {
        $hasError = true;
        $emailSent = false;
        cookie("hasError", "true");
        cookie("dateError", "true");
    } else {
        $date = $date;
    }

//Check to make sure that the time field is not empty
    if($time == '') {
        $hasError = true;
        $emailSent = false;
        cookie("hasError", "true");
        cookie("timeError", "true");
    } else {
        $time = $time;
    }

```

I'm still learning my way around PHP so thanks in advance for any help you can give. :)

**//EDIT**

`appt` is from a URL query string. Even if the query string is not present & the inputs are disabled, I'm using jQuery to add or remove `disabled` from the inputs upon clicking a link on the page.