I keep getting an the undefined index error for the workoutDate variable, even though It still puts a value into the database. I just want to get rid of the error because it is annoying. Sorry if I'm too vague.
session_start();
include'connect.inc.php';
if(!isset($_POST['exercise']))
{
        showForm();
} 
    else
{
        processExercise();       
}
function showForm()
{
$self = htmlentities($_SERVER['PHP_SELF']);     
    echo("<form id='exerciseForm' action = '$self' method = 'POST'>
          <fieldset>
          <legend><strong>Exercise entry Form</strong></legend>");
    echo("<table border='1'>");
    echo("<tr><td>Workout name</td><td><select name = 'workoutName'><option value='cycling'>Cycling</option><option value='swimming'>Swimming</option><option value='running'>Running</option><option value='gym'>Gym</option></td></tr>    
          <tr><td>Date </td><td><input name = 'workoutDate' type='button' id='datepicker'  value = '".date('d-m-Y')."'/></td></tr>
          <tr><td>Duration (mins)</td><td><input name = 'workoutDuration' type = 'text' id = 'workoutDuration'></td></tr>      
          <tr><td>Distance (if appicable)</td><td><input name = 'workoutDistance' type = 'text' id = 'workoutDistance'></td></tr>  
          <tr><td>Comment</td><td><input name = 'workoutComment' type = 'text' id = 'workoutComment'></td></tr>
          ");
    echo("</tr>");
    echo("</table>");
    echo("<input type='submit' name='exercise' id ='exercise' value = 'Add exercise'>
          </fieldset>
          </form>");
}
function processExercise()
{
            var_dump(isset($_POST['workoutDate'])); 
        $workoutName = $_POST['workoutName'];
    $workoutDate = $_POST['workoutDate'];
    $workoutDuration = $_POST['workoutDuration'];
    $workoutDistance = $_POST['workoutDistance'];
    $workoutComment = $_POST['workoutComment'];
    $currentuserID = ($_SESSION['userID']);
    //strip slashes and tags
    //$workoutName = stripslashes($workoutName);
            $workoutName = mysql_real_escape_string($workoutName);
    $workoutName = strip_tags($_POST['workoutName']); 
    //$workoutDate = stripslashes($workoutDate);
            //$workoutDate = mysql_real_escape_string($workoutDate);
    //$workoutDate = strip_tags($_POST['workoutDate']);
    $workoutDuration = stripslashes($workoutDuration);
            $workoutDuration = mysql_real_escape_string($workoutDuration);
    $workoutDuration = strip_tags($_POST['workoutDuration']);
    $workoutDistance = stripslashes($workoutDistance);
            $workoutDistance = mysql_real_escape_string($workoutDistance);
    $workoutDistance = strip_tags($_POST['workoutDistance']);
    $workoutComment = stripslashes($workoutComment);
            $workoutComment = mysql_real_escape_string($workoutComment);
    $workoutComment = strip_tags($_POST['workoutComment']);
            if($workoutDate == "")
            {
                $workoutDate = date('Y-m-d');
            }
            $phpDate = strtotime($workoutDate);
            $date = date('Y-m-d',$phpDate);
            //Auto comment
            if($workoutComment == "")
            {                    
                $workoutComment = "Todays workout was $workoutName" ;                    
            }
    $insertQuery = "INSERT into workout (workoutName, workoutDate, workoutDuration, workoutDistance, workoutComment, userID)
                          values ('$workoutName', '$date', '$workoutDuration', '$workoutDistance', '$workoutComment', '$currentuserID')";
             $result = mysql_query($insertQuery);
            $count = mysql_insert_id();
    showForm();
}
 
     
     
    