html - Why does this php code not display my calendar given the year and month? -
I select the dropdown and do not populate anything. I'm not sure why? I'm new to PHP so any help is greatly appreciated.
Here's my code:
& lt; Section id = "content" class = "planer" & gt; & Lt; Select ID = "month" name = "month" & gt; & Lt; Option value = "0" & gt; - Choose Month - & lt; / Options & gt; & Lt; Option value = "Jan" & gt; January & lt; / Options & gt; & Lt; Option value = "fable" & gt; February & lt; / Options & gt; & Lt; Option value = "march" & gt; March & lt; / Options & gt; & Lt; Option value = "April" & gt; April & lt; / Options & gt; & Lt; Option value = "may" & gt; May & lt; / Options & gt; & Lt; Option value = "June" & gt; June & lt; / Options & gt; & Lt; Option value = "July" & gt; July & lt; / Options & gt; & Lt; Option value = "August" & gt; August & lt; / Options & gt; & Lt; Option value = "September" & gt; September & lt; / Options & gt; & Lt; Option value = "Oct" & gt; October & lt; / Options & gt; & Lt; Option value = "November" & gt; November & lt; / Options & gt; & Lt; Option value = "December" & gt; December & lt; / Options & gt; & Lt; / Select & gt; & Lt; Select ID = "year" name = "year" & gt; & Lt; Option value = "0" & gt; - Select year - & lt; / Options & gt; & Lt; Option value = "2010" & gt; 2010 & lt; / Options & gt; & Lt; Option value = "2011" & gt; 2011 & lt; / Options & gt; & Lt; Option value = "2012" & gt; 2012 & lt; / Options & gt; & Lt; Option value = "2012" & gt; 2013 & lt; / Options & gt; & Lt; Option value = "2012" & gt; 2014 & lt; / Options & gt; & Lt; Option value = "2012" & gt; 2015 & lt; / Options & gt; & Lt; Option value = "2012" & gt; 2016 & lt; / Options & gt; & Lt; / Select & gt; & Lt; Table class = "month" & gt; & Lt; Tr class = "days" & gt; & Lt; TD & gt; Mon & lt; / TD & gt; & Lt; TD & gt; Mars & lt; / TD & gt; & Lt; TD & gt; Mercury & lt; / TD & gt; & Lt; TD & gt; Guru & lt; / TD & gt; & Lt; TD & gt; Fri & lt; / TD & gt; & Lt; TD & gt; Saturn & lt; / TD & gt; & Lt; TD & gt; Sun & lt; / TD & gt; & Lt; / TR & gt; & Lt ;? Php if ($ _ POST ['month'] and $ _POST ['year']! = 0) {$ Today = Date ("D"); // current day $ month = $ _ POST ['month']; $ Years = $ _ post ['year']; GenerateCalendar ($ $ $ month, $ year); } Festival GenerateCalendar ($ Today, $ Month, $ Year) {$ Today = Date ("D"); // current day $ day = cal_days_in_month (CAL_GREGORIAN, $ month, $ year); // $ in last month $ lastmonth = date ("t", mktime (0,0,0, $ month-1, year)); // Month of last month $ start = date ("N", mktime (0,0,0, $ month, 1, $ year)); // The starting day of the current month $ expired = date ("n", mktime (0,0,0, $ month, $ day, $ year)); // Last day of the current month $ last start = $ start - 1; // last month month calander $ counter = 1; $ Next montacture = 1; If ($ start> 5) {$ line = 6; } And {$ line = 5; } For ($ i = 1; $ i & lt; = $ rows; $ i ++) {resonant '& lt; Tr class = "week" & gt; '; ($ X = 1; $ x & lt; = 7; $ x ++) {If (($ counter - $ start) & lt; 0) {$ date = (($ lastmonth - $ laststart) + $ counter) ; $ Class = 'class = "blur"'; } And if (($ counter - $ start)> = $ day) {$ date = ($ nextMththCounter); $ NextMonthCounter ++; $ Class = 'class = "blur"'; } And {$ date = ($ counter - $ start + 1); If ($ Today $ == $ counter - $ start + 1) {$ class = 'class = "Today"'; }} Echo & lt; td '. $ class. ' & Gt; & Lt; One class = "date" & gt; '$ Date' & lt; / A & gt; & Lt; / TD & gt; '; $ Counter ++; $ Class = ''; } Echo & lt; / Tr & gt; '; }}? & Gt; & Lt; / Table & gt; & Lt; / Section & gt;
You can specify html & lt; Form & gt; Tags You also need an input type to send a form around your selected statements & lt; Form action = "" method = "POST" name = "myForm" & gt; & Lt ;! - Your selection - & gt; & Lt; Input type = "submit" value = "send this form" /> & Lt; / Form & gt; The form action "" sends post data to your current page. The method is either post or GET, you are using POST.
All of this should be considered before learning HTML basics before continuing on Php.
Comments
Post a Comment