Forum Moderators: coopster
Here is what I have in a nut shell:
<form method="post" name="schedule" action="schedule.php"><input name="btnSign" type="submit" value="Make Schedule"></form>
Thanks in advance!
<html>
<head>
<title>Make Your Own Schedule</title>
<link href="schedule.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="left">
<h1><div class="titlez2"><center>Make a New Schedule:</center></div></h1>
<form method="post" name="schedule" action="">
<div class="labelz">Name:</div>
<div class="fieldz">
<input name="name" type="text" size="50" maxlength="50">
</div>
<div class="labelz">Year at CFS:</div>
<div class="fieldz">
<input type="radio" name="year" value="Freshmen">Freshmen
<input type="radio" name="year" value="Sophomore">Sophomore
<input type="radio" name="year" value="Junior">Junior
<input type="radio" name="year" value="Senior">Senior
</div>
<div class="labelz">Adviser:</div>
<div class="fieldz">
<select name="adviser">
<option value="null" selected>--Select Your Adviser--</option>
<option value="Dave Worden">Dave Worden</option>
<option value="Rob LaVelle">Rob LaVelle</option>
<option value="Ken Mitchell">Ken Mitchell</option>
<option value="Frances Brindle">Frances Brindle</option>
<option value="Jamie Hysjulien">Jamie Hysjulien</option>
<option value="Bryce Little">Bryce Little</option>
<option value="Willy Rotella">Willy Rotella</option>
<option value="Elise London">Elise London</option>
<option value="Jon Lepofsky">Jon Lepofsky</option>
<option value="Susan Kincaid & Tim O'Hara">Susan Kincaid & Tim O'Hara</option>
<option value="Guillermo Parra">Guillermo Parra</option>
<option value="Amelia Shull">Amelia Shull</option>
<option value="Carrie Huff">Carrie Huff</option>
</select>
</DIV>
<div class="labelz">First Period:</div>
<div class="fieldz">
<input name="first" type="text" size="50" maxlength="50">
</div>
<div class="labelz">Second Period:</div>
<div class="fieldz">
<input name="second" type="text" size="50" maxlength="50">
</div>
<div class="labelz">Third Period:</div>
<div class="fieldz">
<input name="third" type="text" size="50" maxlength="50">
</div>
<div class="labelz">Fourth Period:</div>
<div class="fieldz">
<input name="fourth" type="text" size="50" maxlength="50">
</div>
<div class="labelz">Fifth Period:</div>
<div class="fieldz">
<input name="fifth" type="text" size="50" maxlength="50">
</div>
<div class="labelz">Sixth Period:</div>
<div class="fieldz">
<input name="sixth" type="text" size="50" maxlength="30">
</div>
<div class="labelz">Seventh Period:</div>
<div class="fieldz">
<input name="seventh" type="text" size="50" maxlength="30">
</div>
<div class="labelz">Eighth Period:</div>
<div class="fieldz">
<input name="eighth" type="text" size="50" maxlength="30">
</div>
<div class="titlez1"><center><input name="btnSign" value="Make Schedule" type="submit"></center></div></form></div>
<?php
include 'login.php';
if(isset($_POST['btnSign']))
{
include 'login.php';
$name = trim($_POST['name']);
$adviser = trim($_POST['adviser']) OR DIE ("MESSAGE!");
$year = trim($_POST['year']);
$first = trim($_POST['first']);
$second = trim($_POST['second']);
$third = trim($_POST['third']);
$fourth = trim($_POST['fourth']);
$fifth = trim($_POST['fifth']);
$sixth = trim($_POST['sixth']);
$seventh = trim($_POST['seventh']);
$eighth = trim($_POST['eighth']);
{
$query = "INSERT INTO schedule(name, year, adviser, first, second, third, fourth, fifth, sixth, seventh, eighth) VALUES ('$name', '$year', '$adviser', '$first', '$second', '$third', '$fourth', '$fifth', '$sixth', '$seventh', '$eighth')";
}
{
mysql_query($query) or die('YOUR FIELD WAS TO LONG!');
//header('Location: ' . $_SERVER['REQUEST_URI']);
exit;
} }
?>
</body>
</html>
[edited by: jatar_k at 1:30 am (utc) on May 8, 2008]
[edit reason] inserted code [/edit]
then you would need to uncomment this line
//header('Location: ' . $_SERVER['REQUEST_URI']);
but I think you would need to have your display script in there like so
header('Location: schedule.php');
though the above only works if schedule.php is in the same directory as the form