PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old June 30th, 2009, 01:07 PM
rfairweather rfairweather is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 13 rfairweather User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 13 m 46 sec
Reputation Power: 0
Coding a calendar with checkboxes

I want to code a simple calendar that looks like this:

1stop-print.(c)(o)(m)/calendar_mock.jpg (i cant post links as a new user!)

The Select all button selects all of the check boxes in the month that is displayed.

the > and < buttons next to the month name change the month that is currently displayed. It should remember all of the checkboxes selected in each month, so when you come back to that month they are still selected. THIS IS THE BIGGEST CONCEPT I NEED TO LEARN.

The >> buttons next to each row select all of the checkboxes on that given row. Pressing it again unselects the entire row.

Done button, takes all of the checked boxes (in all of the months) and submits them.

.....

How difficult would this be to code? I have pretty decent html and css skill and I can read and understand php without much effort.. but coding is another issue. I need to know if any of you have any suggestions on how to code this bad boy.

Any tutorials that you think would help would be most useful. I've coded it in html, but its not functional. I need a starting point really...

Thank you so much.

Reply With Quote
  #2  
Old June 30th, 2009, 01:47 PM
MatthewJ MatthewJ is offline
Contributing User
Click here for more information.
 
Join Date: May 2007
Location: Davenport, Iowa
Posts: 563 MatthewJ User rank is Private First Class (20 - 50 Reputation Level)MatthewJ User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 21 h 16 m
Reputation Power: 3
I don't remember where I got the calendar script itself, so if it is weird, it isn't my fault

This should get you on the right track though

Code:
<?php
$monthNames = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
?>

<?php
if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n");
if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y");
?>

<?php
$cMonth = $_REQUEST["month"];
$cYear = $_REQUEST["year"];

$prev_year = $cYear;
$next_year = $cYear;

$prev_month = $cMonth-1;
$next_month = $cMonth+1;

if ($prev_month == 0 ) {
$prev_month = 12;
$prev_year = $cYear - 1;
}
if ($next_month == 13 ) {
$next_month = 1;
$next_year = $cYear + 1;
}
?>
<html>
<head>
<title>PHP Calendar</title>
<script type="text/javascript">
function checkall() {
	
var coll = document.getElementsByName('cb');

for(var i = 0;i < coll.length; i++) {
	
	document.getElementsByName('cb')[i].checked = true;
	document.getElementById('checklink').innerHTML = "<a class='usepointer' onclick='uncheckall();'>Uncheck All</a>";
	
}
	
}

function uncheckall() {
	
var coll = document.getElementsByName('cb');

for(var i = 0;i < coll.length; i++) {
	
	document.getElementsByName('cb')[i].checked = false;
	document.getElementById('checklink').innerHTML = "<a class='usepointer' onclick='checkall();'>Check All</a>";
}
	
}
</script>
</head>
<body>
<style type="text/css">
.usepointer { cursor: pointer; }
</style>
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="mainTableTOC">
  <tr>
    <td class="monthYearRowTOC" colspan="7"><table width="100%">
      <tr>
        <td width="11%" class="monthYearTextTOC"><a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $prev_month . "&year=" . $prev_year; ?>"><<</a></td>
        <td width="80%" class="monthYearTextTOC"><div align="center"><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></div></td>
        <td width="9%" class="monthYearTextTOC" style="text-align: right;"> <a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $next_month . "&year=" . $next_year; ?>">>></a></td>
      </tr>
    </table></td>
  </tr>
  <tr class="dayNamesTextTOC">
    <td class="dayNamesRowTOC">Sun</td>
    <td class="dayNamesRowTOC">Mon</td>
    <td class="dayNamesRowTOC">Tue</td>
    <td class="dayNamesRowTOC">Wed</td>
    <td class="dayNamesRowTOC">Thu</td>
    <td class="dayNamesRowTOC">Fri</td>
    <td class="dayNamesRowTOC">Sat</td>
  </tr>
  <?php
$timestamp = mktime(0,0,0,$cMonth,1,$cYear);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
$startday = $thismonth['wday'];
$today = date("d");

for ($i=0; $i<($maxday+$startday); $i++) {
if(($i % 7) == 0 ) echo "\n".'<tr class="rowsTOC">';
if($i < $startday) echo '<td class="sOtherTOC"></td>'. "\n" ;
else echo "\n" .'<td class="s20TOC"><div class=daynumTOC>'. ($i - $startday + 1) . '</div>'."\n".'<div class="titleTOC"><input type=\'checkbox\' name=\'cb\' /></div></td>';
if(($i % 7) == 6 ) { echo "\n</tr>";}
}
if($startday > 4)
{
$maxtable = 42;
}
else
{
$maxtable = 35;
}
$blank = $maxday + $startday;
$draw = $maxtable - $blank;

$i = 1;
while($i <= $draw)
{
echo '<td class="sOtherTOC"></td>';
$i++;
}
echo "</tr></table>";


?>
<p id="checklink"><a class="usepointer" onClick="checkall();">Check All</a></p>
</body>
</html>

Reply With Quote
  #3  
Old June 30th, 2009, 03:12 PM
rfairweather rfairweather is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 13 rfairweather User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 13 m 46 sec
Reputation Power: 0
Thanks alot. Although it doesn't remember what was checked off when you switch to another month and then switch back... which was my main issue.

Anyone else?

Reply With Quote
  #4  
Old June 30th, 2009, 05:40 PM
MatthewJ MatthewJ is offline
Contributing User
Click here for more information.
 
Join Date: May 2007
Location: Davenport, Iowa
Posts: 563 MatthewJ User rank is Private First Class (20 - 50 Reputation Level)MatthewJ User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 21 h 16 m
Reputation Power: 3
People here aren't going to write your code for you... the script I posted should give you an idea of how coding a calendar works.If you need to save over checked boxes, you would probably want to use sessions and store what was checked. If you want someone to just code it for you, offer to pay them.

Reply With Quote
  #5  
Old July 1st, 2009, 12:15 PM
rfairweather rfairweather is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 13 rfairweather User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 13 m 46 sec
Reputation Power: 0
Deal. 50USD through paypal for someone who can code this.

Amember experience is not a necessity but is a bonus.

The calendar will be used as a “shopping cart” in a way. Each checkbox represents a product. When it is checked the product is essentially “added to cart” and unchecked it is not added to cart. Amember code deals with all of this.

The Select all button selects all of the check boxes in the month that is displayed.

The > and < buttons next to the month name change the month that is currently displayed. It should remember all of the checkboxes selected in each month, so when you come back to that month they are still selected.

The >> buttons next to each row select all of the checkboxes on that given row. Pressing it again unselects the entire row.

Done button, takes all of the checked boxes (in all of the months) and submits them.
It should be easily customizable such that I can simply edit one file and add/remove where checkboxes are and also change the link that each checkbox is associated with. It should be easy to add months (even if this means that I have to manually state the day number and where the checkboxes are located in the 7 x 6 grid)
This is a sample of what the amember checkbox code looks like that should appear in EACH day of EACH month:

<input type="checkbox" id="product1" name="product_id[]" value="2"/>

SEE THE LINK IN THE FIRST POST FOR WHAT IT SHOULD LOOK LIKE.

If anyones interested, I can post the html template that is shown in that picture.

Reply With Quote
  #6  
Old July 1st, 2009, 12:40 PM
jamestrowbridge jamestrowbridge is offline
Contributing User
Click here for more information.
 
Join Date: Jul 2008
Location: Cleveland, Ohio, USA
Posts: 411 jamestrowbridge User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 18 h 54 m 24 sec
Reputation Power: 2
Are you using a database backend at all?
__________________
Sir, a desire of knowledge is the natural feeling of mankind; and every human being, whose mind is not debauched, will be willing to give all that he has to get knowledge.

Reply With Quote
  #7  
Old July 1st, 2009, 12:55 PM
rfairweather rfairweather is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 13 rfairweather User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 13 m 46 sec
Reputation Power: 0
What benefits would that have?

I have no problem editing one file manually writing in the month name, which of the 7x6 squares have a numbers and check box (and filling in the checkbox information).

Amember is a php code script that is installed on the host, and protects certain folders so only "members" who create an account with us have access to them. It deals with all of the backend stuff with mysql databases etc. But its fairly easy to customize... and you really dont need to even be bothered with it.

I just need a php calendar that has sessions that remembers checked checkboxes and then when the "done" buttons is pressed, it submits all of the checked boxes with:

<input type="hidden" name="action" value="renew" />
<input type="submit" value="Done" />

But its up to you. Aslong as it works

Last edited by rfairweather : July 1st, 2009 at 01:03 PM.

Reply With Quote
  #8  
Old July 1st, 2009, 10:26 PM
jamestrowbridge jamestrowbridge is offline
Contributing User
Click here for more information.
 
Join Date: Jul 2008
Location: Cleveland, Ohio, USA
Posts: 411 jamestrowbridge User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 18 h 54 m 24 sec
Reputation Power: 2
If no one else hooks you up and I'm bored at work tomorrow, I'll finish the thing I started writing today.. and $50 USD later...it's yours. I'll try to avoid the database.

Reply With Quote
  #9  
Old July 2nd, 2009, 06:04 PM
jamestrowbridge jamestrowbridge is offline
Contributing User
Click here for more information.
 
Join Date: Jul 2008
Location: Cleveland, Ohio, USA
Posts: 411 jamestrowbridge User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 18 h 54 m 24 sec
Reputation Power: 2
I'm almost done, just need to make the 'check all boxes in row' buttons.... everything else is good though.

Reply With Quote
  #10  
Old July 2nd, 2009, 09:55 PM
jamestrowbridge jamestrowbridge is offline
Contributing User
Click here for more information.
 
Join Date: Jul 2008
Location: Cleveland, Ohio, USA
Posts: 411 jamestrowbridge User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 18 h 54 m 24 sec
Reputation Power: 2
rfairweather I've got it pretty much done, let me know how you'd like to exchange.

Reply With Quote
  #11  
Old July 3rd, 2009, 01:20 AM
IAmALlama IAmALlama is offline
Me
Click here for more information. Click here for more information
Click here for more information
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 1,937 IAmALlama User rank is Private First Class (20 - 50 Reputation Level)IAmALlama User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 5 Days 1 h 54 m 18 sec
Reputation Power: 4
this is what I came up with. I didn't feel like trying to do a table-less design because I didn't want to deal with browser differences (box model...grrrr) so I just used a table. It is completely done by javascript so no page loads when you click for a next/previous month and it remembers everything. It uses jquery (just a javascript library) to make it easy and the jquery is even pointing to the file hosted on google so you don't need to download/load it. The only thing that is a little odd is the date format which can be changed easily, but currently just uses the javascript Date.toDateString() (IE: "Fri Jul 31 2009"). If there is another format you would prefer, I/you can change it. I confirmed it to work in both IE and FF. All the months are working as far as I can tell and I've even tried selecting like an entire year and clicking done and it all showed up fine. Also, I confirmed that the format of the dates is compatible with php's strtotime() function to convert them to unix timestamps. Oh and it would be VERY easy to modify to have like php pull dates out of a db/file and check those boxes like if later on someone wanted to change the dates they had selected. you can just use JSON on the javascript data variable and populate what boxes should be pre-checked. hmmm, i can't think of anything else.
PHP Code:
<?php
if(isset($_POST) && !empty($_POST)){
    echo 
"<pre>";
    
print_r($_POST);
    die();
}
?>
<html>
<head>
<style type="text/css">
table { width: 400px; }
.top { background-color: #C0C0C0; }
.leader { background-color: #D7D7D7; }
.days { background-color: #EDEDED; }
.today { background-color: #909090; color: #FFFFFF; }
.button { width: 48px; }
.wideButton { width: 98px; }
td { width: 50px; height: 25px; text-align: center; }
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
  var today = new Date();
  var date = new Date();
  var month = date.getMonth();
  var year = date.getFullYear();
  var months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
  var data = {};
  //to pre-check checkboxes, use this format.
  //var data = {'Wed Jul 01 2009':true,'Thu Jul 02 2009':true};
  var checkBox = $("<input type='checkbox'/>");
  var checked1 = false;

  function fillCalendar(){
    month = date.getMonth();
    year = date.getFullYear();
    var offset=date.getDay();
    var clone;
    var checked = false;
    $("#month").text(months[month]);
    $("#calendar .day").each(function(i){
      $(this).removeClass("today");
      if(offset+date.getDate()-1==i){
        checked = (data[date.toDateString()])?true:false;
        $(this).html(date.getDate());
        clone = checkBox.clone().attr("title",date.toDateString()).prependTo(this);
        if(checked)clone.click();
        if(date.toDateString() == today.toDateString()) $(this).addClass("today");
        date.setDate(date.getDate()+1);
      } else {
        $(this).html("");
      }
    });
    date.setMonth(month);
    date.setFullYear(year);
    $(".day input:checkbox").unbind("click").click(function(){
      var title = $(this).attr("title");
      if(this.checked){
        data[title] = true;
      } else {
        delete data[title];
      }
      return true;
    });
  }

  $(document).ready(function(){
    $("#selectAll").click(function(){$("#calendar input:checkbox").each(function(){
      if(checked1==this.checked) this.click();
    });checked1=!checked1;return false;});
    $("#calendar .selectRow").click(function(event){
      var checked2 = !$(event.target).parent().parent().find("input:checkbox")[0].checked;
      $(event.target).parent().parent().find("input:checkbox").each(function(){ if(this.checked!=checked2)this.click();});
      return false;
    });    
    $("#prevMonth").click(function(){date.setMonth(date.getMonth()-1);fillCalendar();});
    $("#nextMonth").click(function(){date.setMonth(date.getMonth()+1  );fillCalendar();});
    $("#done").click(function(){
      var theForm = $("#theForm");
      $.each(data, function(key, val){
        theForm.append("<input type='hidden' name='dates[]' value='" + key + "'>");
      });
      theForm.submit();
    });
    
    date.setDate(1);
    fillCalendar();
  });
</script>
</head>
<body>
<form method="post" action="#" id="theForm">
<table cellpadding="0" cellspacing="2" id="calendar">
<tr class="top">
<td><input type="button" class="button" id="prevMonth" value="<" /></td>
<td colspan=2 id="month">&nbsp;</td>
<td><input type="button" class="button" id="nextMonth" value=">" /></td>
<td colspan=2><input type="button" value="Select All" class="wideButton" id="selectAll"></td>
<td colspan=2><input type="button" value="Done" class="wideButton" id="done" /></td>
</tr>
<tr class="leader">
<td></td>
<td>Sun</td>
<td>Mon</td>
<td>Tue</td>
<td>Wed</td>
<td>Thu</td>
<td>Fri</td>
<td>Sat</td>
</tr>
<tr class="days" id="test">
<td class="leader"><input type="button"value=">>" class="selectRow button" /></td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
</tr>
<tr class="days">
<td class="leader"><input type="button"value=">>" class="selectRow button" /></td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
</tr>
<tr class="days">
<td class="leader"><input type="button"value=">>" class="selectRow button" /></td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
</tr>
<tr class="days">
<td class="leader"><input type="button"value=">>" class="selectRow button" /></td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
</tr>
<tr class="days">
<td class="leader"><input type="button"value=">>" class="selectRow button" /></td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
</tr>
<tr class="days">
<td class="leader"><input type="button"value=">>" class="selectRow button" /></td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
<td class="day">&nbsp;</td>
</tr>
<tr>
<td class="leader" colspan="8">&nbsp;</td>
</tr>
</table>
<input type="hidden" name="action" value="renew" />
</form>
</body>
</html>

edit: forgot to add that the select row thing. It looks up the first checkbox in that row and uses that as reference for whether the rest in the row should be checked or not. So if you check the first box in a row and click the button on that row, all will be unselected and vise-versa for if the first box is unchecked.

Last edited by IAmALlama : July 3rd, 2009 at 01:36 AM. Reason: Fixed a small bug with the select all button.

Reply With Quote
  #12  
Old July 3rd, 2009, 08:23 AM
jamestrowbridge jamestrowbridge is offline
Contributing User
Click here for more information.
 
Join Date: Jul 2008
Location: Cleveland, Ohio, USA
Posts: 411 jamestrowbridge User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 18 h 54 m 24 sec
Reputation Power: 2
You done it again Llama....(outro theme music):

I think that's what I'm going to do today: Learn everything I can about jquery.

I suppose I might as well just post the crappy (in comparison) code I made (I took Matt's code and added the stuff to make it work):

PHP Code:
<?php
session_start
();
if(
$_GET['clear']==yes) {
unset(
$_SESSION['cart']);
}

if(isset(
$_GET['unset'])) {
unset(
$_SESSION['cart'][$_GET['unset']]);
}

$monthNames = Array("January""February""March""April""May""June""July""August""September""October""November""December");
?>

<?php

if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n");
if (!isset(
$_REQUEST["year"])) $_REQUEST["year"] = date("Y");

foreach(
$_POST['cb'] as $key=>$value) {

$_SESSION['cart'][$value] = 1;

}

?>

<?php
$cMonth 
$_REQUEST["month"];
$cYear $_REQUEST["year"];

$prev_year $cYear;
$next_year $cYear;

$prev_month $cMonth-1;
$next_month $cMonth+1;

if (
$prev_month == ) {
$prev_month 12;
$prev_year $cYear 1;
}
if (
$next_month == 13 ) {
$next_month 1;
$next_year $cYear 1;
}
?>
<html>
<head>
<title>PHP Calendar</title>
<script type="text/javascript">
function checkall() {
    
var coll = document.getElementsByName('cb[]');

for(var i = 0;i < coll.length; i++) {
    
    document.getElementsByName('cb[]')[i].checked = true;
    
}

}

function checkrow(number) {

for(var i = 0;i < document.getElementsByName('cb[]').length; i++) {
var coll = i + '.' + number;

document.getElementById(coll).checked = true;

}

}


function uncheckall() {
    
var coll = document.getElementsByName('cb[]');

for(var i = 0;i < coll.length; i++) {
    
    document.getElementsByName('cb[]')[i].checked = false;
}
    
}

function submit_form_to_session(URL) {

document.forms[0].action = URL;
document.form1.submit();

}
</script>
</head>
<body>
<form name='form1' method='post' id='form1'>
<style type="text/css">
.usepointer { cursor: pointer; }
</style>
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="mainTableTOC">
  <tr>
    <td class="monthYearRowTOC" colspan="7"><table width="100%">
      <tr>
        <td width="11%" class="monthYearTextTOC"><a href="#" onclick="submit_form_to_session('<?php echo $_SERVER["PHP_SELF"] . "?month="$prev_month "&year=" $prev_year?>'); return false;"><<</a></td>
        <td width="80%" class="monthYearTextTOC"><div align="center"><?php echo $monthNames[$cMonth-1].' '.$cYear?></div></td>
        <td width="9%" class="monthYearTextTOC" style="text-align: right;"> <a href="#" onclick="submit_form_to_session('<?php echo $_SERVER["PHP_SELF"] . "?month="$next_month "&year=" $next_year?>'); return false;">>></a></td>
      </tr>
    </table></td>
  </tr>
  <tr class="dayNamesTextTOC">
    <td class="dayNamesRowTOC">Check Entire Row</td>
    <td class="dayNamesRowTOC">Sun</td>
    <td class="dayNamesRowTOC">Mon</td>
    <td class="dayNamesRowTOC">Tue</td>
    <td class="dayNamesRowTOC">Wed</td>
    <td class="dayNamesRowTOC">Thu</td>
    <td class="dayNamesRowTOC">Fri</td>
    <td class="dayNamesRowTOC">Sat</td>
  </tr>
  <?php
$timestamp 
mktime(0,0,0,$cMonth,1,$cYear);
$maxday date("t",$timestamp);
$thismonth getdate ($timestamp);
$startday $thismonth['wday'];
$today date("d");
$b 0;
$ib 0;
for (
$i=0$i<($maxday+$startday); $i++) {
if((
$i 7) == ) {
echo 
"\n"."<tr class='rowsTOC'><td><p id='checkrowlink.".$b."'><a href=\"#\" onclick=\"checkrow('".$b."'";

echo 
"); return false;\">></a></p></td>";
}
if(
$i $startday) echo "<td class='sOtherTOC'></td>""\n" ;
else { echo 
"\n" ."<td class='s20TOC'><div class='daynumTOC'>". ($day $i $startday 1) . "</div>"."\n"."<div class='titleTOC'><input type='checkbox' name='cb[]'";
$current_one $monthNames[$cMonth-1].'-'.$cYear.'-'.$day;
if(
$_SESSION['cart'][$current_one]==1) {
echo 
' checked=\'checked\'';
}
echo 
" id='";
echo 
$ib$id=$ib$ib++;

echo 
".".$b."'";
echo 
" value='".$monthNames[$cMonth-1]."-".$cYear."-".$day."' /></div></td>";
}
if((
$i 7) == ) { echo "\n</tr>"$b++; $ib=0;}
}
if(
$startday 4)
{
$maxtable 42;
}
else
{
$maxtable 35;
}
$blank $maxday $startday;
$draw $maxtable $blank;

$i 1;
while(
$i <= $draw)
{
echo 
'<td class="sOtherTOC"></td>';
$i++;
}
echo 
"</tr></table>";


?>
</form>
<p id="checklink"><a class="usepointer" href="#" onClick="checkall(); return false;">Check All</a> <a class="usepointer" href="#" onClick="uncheckall(); return false;">UnCheck All</a></p> <a class="usepointer" href="<?php echo $_SERVER['PHP_SELF']."?month=".$cMonth."&clear=yes"?>">Empty Cart</a> <a class="usepointer" href="#" onclick="submit_form_to_session('<?php echo $_SERVER['PHP_SELF']."?month=".$cMonth?>'); return false;">Done</a><br />
In Cart:<br /><?php foreach($_SESSION['cart'] as $k=>$v) { echo $k." - <a href='".$_SERVER['PHP_SELF']."?month=".$cMonth."&unset=".$k."'>Remove From Cart</a><br />"; } ?>
</body>
</html>

Reply With Quote
  #13  
Old July 3rd, 2009, 12:40 PM
IAmALlama IAmALlama is offline
Me
Click here for more information. Click here for more information
Click here for more information
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 1,937 IAmALlama User rank is Private First Class (20 - 50 Reputation Level)IAmALlama User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 5 Days 1 h 54 m 18 sec
Reputation Power: 4
Quote:
Originally Posted by jamestrowbridge
I think that's what I'm going to do today: Learn everything I can about jquery.

Seriously, JQuery is the best thing you can do to learn JS. It makes things SOOOO easy. Completely cross browser, easy "chainable" syntax...all kinds of stuff. I just got the book JQuery in action and went through that. It looks confusing at first, but once you get the hang of it you will see that it is really quite easy.

Reply With Quote
  #14  
Old July 3rd, 2009, 07:33 PM
jamestrowbridge jamestrowbridge is offline
Contributing User
Click here for more information.
 
Join Date: Jul 2008
Location: Cleveland, Ohio, USA
Posts: 411 jamestrowbridge User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 18 h 54 m 24 sec
Reputation Power: 2
Quote:
Originally Posted by IAmALlama
Seriously, JQuery is the best thing you can do to learn JS. It makes things SOOOO easy. Completely cross browser, easy "chainable" syntax...all kinds of stuff. I just got the book JQuery in action and went through that. It looks confusing at first, but once you get the hang of it you will see that it is really quite easy.


Yeah I spent a good 4 hours today reading a bunch of beginner tutorials...it actually makes ajax easier too. So far almost everything seems different from regular Javascript. I like that it's cross browser - such a pain to rewrite code to figure out what works for all.

I'm going to have to get a book to really learn it I think, since it's pretty much it's own language....

Reply With Quote
  #15  
Old July 5th, 2009, 04:24 PM
rfairweather rfairweather is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 13 rfairweather User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 13 m 46 sec
Reputation Power: 0
Thanks both of you. I am not sure what I should do about payments at this point...

Some issues I have with yours llama...

First of all, wow, fantastic work.

Secondly, Is there a way I can set up if statements that say, if the box representing "Thu Jul 02 2009" is checked, then treat the checkbox as if the code was

"<input type="checkbox" id="product1" name="product_id[]" value="X"/>" where the variable X is different for each day. I mean to say that if we were to sell databases for All of july, august and september 2009 we would create 92 products in total, each listed from 1 (july 1st) to 92 (september 30). So if i were to check mark the box on july 1st 2009 and check mark a box on september 30th 2009 then the form would act as if these were the checkboxes that were selected:

<input type="checkbox" id="product1" name="product_id[]" value="1"/>
<input type="checkbox" id="product1" name="product_id[]" value="92"/>

Its just how the arrays are set up with the membership software my site is using, amember.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Coding a calendar with checkboxes


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek