This is the form page:
<?php
$stmt = $mysqli->prepare("SELECT Week, Sport, SessionDate, Time, Coach, Location, Details FROM TrainingSchedule WHERE SessionID = ?");
$stmt->bind_param('i', $_GET['SessionID']);
$stmt->execute();
$stmt->bind_result($Week, $Sport, $Date, $Time, $Coach, $Location, $Details);
$stmt->fetch();
$stmt->close();
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Content Management System</title>
<link href="css.css" rel="stylesheet" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="../includes/datepicker.js"></script>
<link rel="stylesheet" media="screen" type="text/css" href="../includes/datepicker.css" />
</head>
<body>
<div id="container">
<header>
<h1>CMS - <a href="Member.php" title="loginPage">Back to login page</a></h1>
</header>
<div id="CMSform">
<h2>Add New Session</h2>
<section>
<form name="addSession" method="post" action="insertRecord.php">
<p class="indent">
<label for="Week">Week:</label>
<select>
<option value="1">1 == WB 14/01/13</option>
<option value="2">2 == WB 21/01/13</option>
<option value="3">3 == WB 28/01/13</option>
<option value="4">4 == WB 04/02/13</option>
</select>
<input type="submit" name="Week" id="Week" value="">
</p>
<p class="indent">
<label for="Sport">Sport:</label>
<select>
<option value="Bike">Bike</option>
<option value="Run">Run</option>
<option value="StrengthandConditioning">Strength and Conditioning</option>
<option value="Swim">Swim</option>
</select>
<input type="submit" name="Sport" id="Sport" value="">
</p>
<p class="indent">
<label for ="SessionDate">Date: </label>
<input class="inputDate" id="inputDate" value="01/01/2013" />
<script>//http://www.eyecon.ro/datepicker/#about
$('#inputDate').DatePicker({
format:'m/d/Y',
date: $('#inputDate').val(),
current: $('#inputDate').val(),
starts: 1,
position: 'r',
onBeforeShow: function(){
$('#inputDate').DatePickerSetDate($('#inputDate').val(), true);
},
onchange: function(formated, dates){
$('#inputDate').val(formated);
$('#inputDate').DatePickerHide();
}
});
</script>
<input type="submit" name="SessionDate" id="SessionDate" value="">
</p>
<p class="indent">
<label for="Time">Time:</label>
<input type="text" name="Time" id="Time">
</p>
<p class="indent">
<label for="Coach">Coach:</label>
<input type="text" name="Coach" id="Coach">
</p>
<p>
<span class="indent">Location:</span>
<label for="location_pf">Ponds Forge</label>
<input type="radio" name="Location" value="PF" id="PF">
<label for="location_ep">Endcliffe Park</label>
<input type="radio" name="Location" value="EP" id="EP">
<label for="location_cg">Collegiate Gym</label>
<input type="radio" name="Location" value="CG" id="CG" checked>
<label for="location_dvs">Don Valley Stadium</label>
<input type="radio" name="Location" value="DVS" id="DVS">
<label for="location_pd">Peak District</label>
<input type="radio" name="Location" value="PD" id="PD" checked>
<label for="location_h">Home</label>
<input type="radio" name="Location" value="H" id="H" checked>
</p>
<p class="indent">
<label for="Details">Details:</label>
<textarea name="Details" id="Details" cols="45" rows="5"></textarea>
</p>
<p>
<input type="submit" name="Insert" id="Insert" value="Insert Session">
</p>
</form>
>
and this is the page its sent to:
<?php
require_once('../includes/conn.inc.php');
$stmt = $mysqli->prepare("INSERT INTO TrainingSchedule ( Week,
Sport,
SessionDate,
Time,
Coach,
Location,
Details)
VALUES (?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param('issssss', $_POST['Week'],
$_POST['Sport'],
$_POST['SessionDate'],
$_POST['Time'],
$_POST['Coach'],
$_POST['Location'],
$_POST['Details']);
$stmt->execute();
$stmt->close();
header("Location: CMS.php"); // redirect browser
exit; // make sure no other code executed
?>
The data is not being inserted into the TrainingSchedule database table. All of the field names are correct.
Thanks for any help in advance

New Topic/Question
Reply




MultiQuote





|