Correction of code plz

Hi guys, can any one correct my coding please, I want to create a form which ask for a month(dropdown) and year on input and onsubmit it checks if fields are valued and if so submit a page with teh calender of that month. Saterdays and sundays should have different colors, plus the user can choose anotehr month in the page of the month chosen… This is what I’ve tried on my own and i just need direction , thank u…

<html >
<head>
<title>Exercise1</title>
<script type=“text/javascript” src=“jquery/jquery/jquery.js”>
<script type=“text/javascript”>
function valid()
{
var field = “”;
if (!$(‘[name=month]’).val()) field += ‘month
‘;
if (!$(’[name=year]’).val()) field += 'year
';

if (field != “”) {
alert ('Please select the value
'+field);
return false;
}
return true;
}

</script>
<?php
if (!checkdate($_POST[month], 1, $_POST[year])) {
$calArray = getdate();
$month = $calArray[‘mon’];
$year = $calArray[‘year’];
} else
{
$month = $_POST[month];
$year = $_POST[year];
}
$start = mktime (12, 0, 0, $month, 1, $year);
$firstDayArray = getdate($start);

$months = Array(“January”, “February”, “March”, “April”, “May”,

“June”, “July”, “August”, “September”, “October”, “November”, “December”);

for ($x=1; $x <= count($months); $x++) {

print “\ <calender=\”$x\“”;

print ($x == $month)?" SELECTED":“”;

print “>”.$months[$x-1]."
";

}
for ($x=0; $x<=2010; $x++) {
print “\ <calender”;
print ($x == $year)?" SELECTED":“”;
print “>$x
“;
}
?>
<style>
</style>
</head>
<body>
<h3>Calender</h3>
<form method=“post” name=“form” action=“exercise2.php” onsubmit=“return valid()”>
<select name=“month”><option value=””></option>
<option value=“1”>January</option>
<option value=“2”>February</option>
<option value=“3”>March</option>
<option value=“4”>April</option>
<option value=“5”>May</option>
<option value=“6”>June</option>
<option value=“7”>July</option>
<option value=“8”>August</option>
<option value=“9”>September</option>
<option value=“10”>October</option>
<option value=“11”>November</option>
<option value=“12”>December</option>
</select>
Year
<input type=“text” name=“year” size=“4” value=“”>
<input type=“submit” value=“Submit”>
</form>
</body>
</html>

Please approach your teacher/tutor for your primary assistance.

What difficulties are you having?

Soho, I did that arleay thats why i came here!!!thank you

That’s a lot of code that you posted, and there is a world of advice that we might give you, most of it useless to providing what you yourself feel you actually need.

So in light of that, what specific details are you having trouble with, and would like us to provide assistance towards?

Answer along the lines of “just make it work” are not likely to be taken seriously.

Code can always be made simpler. You have a script that “doesn’t work”, take it apart, get the form working, get the form posting, is what is posted what is expected? yes? add the js to check the form, does it work? … etc … etc …

Basically what the guys are saying is dig through it yourself and try to understand what your code IS doing and what it is SUPPOSED to be doing.

Whilst we’re keen to assist people, we won’t do their work for them :slight_smile:

If you have tried to fix it, outline exactly what you have done. Learning to debug is the vital step one needs to take in order to really learn computer programming.