• (3 Pages)
  • +
  • 1
  • 2
  • 3

Event Tracking Calendar Rate Topic: ***** 1 Votes

#16 Eluway  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 29-June 11

Posted 27 July 2011 - 07:31 AM

Okay so I've done some more monkeying with the code and added an are you human box with the help of captcha as well as some extra fields. I'm currently working on getting the pop up window to fade in using ajax and also trying to get the current day highlighted and end times for the events. If anyone has any brainwaves on this I'd appreciate it.

But since this has been such a HUGE help to me I thought I would post my progress for others =-). My script has now been divided into 3 files.

calendar.php


<?php
	//Include database connection details
	require_once('config.php');
	
	//Connect to mysql server
	$mysql = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
	if(!$mysql) {
		die('Failed to connect to server: ' . mysql_error());
	}
	mysql_select_db("fpe_calendar2", $mysql) or die( "Unable to select database" .  mysql_error());
	define("ADAY", (60*60*24));


if ((!isset($_POST['month'])) || (!isset($_POST['year']))) {
	$nowArray = getdate();
	$month = $nowArray['mon'];
	$year = $nowArray['year'];
} else {
	$month = $_POST['month'];
	$year = $_POST['year'];
}
$start = mktime(12,0,0,$month,1,$year);
$firstDayArray = getdate($start);
?>
<html>
<head>
<title><?php echo "Calendar: ".$firstDayArray['month']."" . $firstDayArray['year']; ?></title>
<script type="text/javascript">
function eventWindow(url){
	event_popupWin = window.open(url, 'event', 'resizable=yes, scrollbars=yes, toolbar=no,width=800,height=900');
	event_popupWin.opener = self;
}
</script>
</head>
<body><center>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select name="month">
<?php
$months = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

for ($x=1; $x<=count($months); $x++){
	echo "<option value=\"$x\"";
	if ($x == $month){
		echo " selected";
	}
	echo ">".$months[$x-1]."</option>";
}
?>
</select>
<select name="year">
<?php
$thisYear = date('Y');
for ($x=$thisYear - 0; $x<=$thisYear + 2; $x++){ 
        echo "<option"; 
        if ($x == $year){ 
                echo " selected"; 
        } 
        echo ">$x</option>"; 
}

?>
</select>
<input type="submit" name="submit" value="Dazzle Me">
</form>
<br />
<?php
$days = Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
echo "<table border=\"1\" cellpadding=\"5\"><tr>\n";
foreach ($days as $day) {
	echo "<td style=\"background-color: #CCCCCC; text-align: center; width: 14%\">
	      <strong>$day</strong></td>\n";
}

for ($count=0; $count < (6*7); $count++) {
	$dayArray = getdate($start);
	if (($count % 7) == 0) {
		if ($dayArray["mon"] != $month) {
			break;
		} else {
			echo "</tr><tr>\n";
		}
	}
	if ($count < $firstDayArray["wday"] || $dayArray["mon"] != $month) {
		echo "<td> </td>\n";
	} else {
		$chkEvent_sql = "SELECT event_title FROM calendar_events WHERE month(event_start) = '".$month."' AND dayofmonth(event_start) = '".$dayArray["mday"]."' AND year(event_start) = '".$year."' ORDER BY event_start";
		$chkEvent_res = mysql_query($chkEvent_sql) or die(mysql_error());

		if (mysql_num_rows($chkEvent_res) > 0) {
			$event_title = "<br/>";
			while ($ev = mysql_fetch_array($chkEvent_res)) {
				$event_title .= stripslashes($ev["event_title"])."<br/>";
			}
			mysql_free_result($chkEvent_res);
		} else {
			$event_title = "";
		}
		echo "<td valign=\"top\"><a href=\"javascript:eventWindow('event.php?m=".$month."&d=".$dayArray["mday"]."&y=$year');\">".$dayArray["mday"]."</a><br/>".$event_title."</td>\n";

		unset($event_title);

		$start += ADAY;
	}
}
echo "</tr></table>";
mysql_close($mysql);
?>
</body>
</html>



event.php


<html>
<head>
<title>Show / Add Events</title>
</head>
<body><center>
<h1>Events <?php 
	if ($_POST){
		echo $_POST['m']." / " .  $_POST['d']." / " . $_POST['y'];
	}
	else {
		echo $_GET['m']." / " . $_GET['d']." / " . $_GET['y'];
		} 
?></h1> </center>
<?php
session_start();

	//Include database connection details
	include('config.php');

	//Connect to mysql server
	$mysql = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
	if(!$mysql) {
		die('Failed to connect to server: ' . mysql_error());
	}
	mysql_select_db("yourtablename", $mysql) or die( "Unable to select database" .  mysql_error());
	
	// Add our new events
if ($_POST){
	$m = $_POST['m'];
	$d = $_POST['d'];
	$y = $_POST['y'];

	 //Formatting for SQL datetime (if this is edited, it will NOT work.)
	$event_date = $y."-".$m."-".$d." ".$_POST["event_time_hh1"].":".$_POST["event_time_mm1"].":00";

	$insEvent_res = mysql_query($insEvent_sql, $mysql)
			or die(mysql_error($mysql));
} else {
	$m = $_GET['m'];
	$d = $_GET['d'];
	$y = $_GET['y'];
}
// Show the events for this day:
$getEvent_sql = "SELECT event_title, event_shortdesc, event_price, dress_code, event_local, event_link, 
		date_format(event_start, '%l:%i %p') as fmt_date FROM
		calendar_events WHERE month(event_start) = '".$m."'
		AND dayofmonth(event_start) = '".$d."' AND
		year(event_start)= '".$y."'
		ORDER BY event_start";
$getEvent_res = mysql_query($getEvent_sql, $mysql)
		or die(mysql_error($mysql));

if (mysql_num_rows($getEvent_res) > 0){
	$event_txt = "<ul>";
	while($ev = @mysql_fetch_array($getEvent_res)){
		$event_title = stripslashes($ev["event_title"]);
		$event_shortdesc = stripslashes($ev["event_shortdesc"]);
		$fmt_date = $ev["fmt_date"];
		$event_price = $ev["event_price"];
		$dress_code = $ev["dress_code"];
		$event_local = $ev["event_local"];
		$event_link = $ev["event_link"];
		$event_txt .= "<li><strong><h3>".$event_title."</h3></strong>
			      ".$fmt_date." @ ".$event_local."<br/> Event Price: ".$event_price." | Dress Code: ".$dress_code."<p>".$event_shortdesc.
				  "<br/> Get more info at: <a href=http://".$event_link.">".$event_link."</a></li><p>";
	}
	$event_txt .="</ul>";
	mysql_free_result($getEvent_res);
} else {
	$event_txt = "";
}

mysql_close($mysql);

if ($event_txt != ""){
	echo "<p><strong>Today's Events:</strong></p>
	$event_txt
	<hr/>";
}

// Show form for adding the event:

echo "
<form method=\"post\" action=\"verify.php\">
<p><strong><h2><center>Add Event:</center></h2></strong></p>
<center><table border=5><tr><td>
<p><strong>Event Title:</strong>
<input type=\"text\" name=\"event_title\" size=\"25\" maxlength=\"75\"/></p>
<p><strong>Event Description:</strong><br/>
<textarea name=\"event_shortdesc\" rows=\"10\" cols=\"30\" size=\"50\" maxlength=\"650\"/></textarea>
<p><strong>Link:</strong>
http://<input type=\"text\" name=\"event_link\" size=\"25\" maxlength=\"150\"/></p>
</td><td valign=top>
<p><strong>Event Start Time:</strong><br/>
<select name=\"event_time_hh\">";
for ($x=1; $x<=24; $x++){
	echo "<option value=\"$x\">$x</option>";
}
echo "</select> :
<select name=\"event_time_mm\">
<option value=\"00\">00</option>
<option value=\"15\">15</option>
<option value=\"30\">30</option>
<option value=\"45\">45</option>
</select>
<input type=\"hidden\" name=\"m\" value=\"".$m."\">
<input type=\"hidden\" name=\"d\" value=\"".$d."\">
<input type=\"hidden\" name=\"y\" value=\"".$y."\">
<br/>
<p><strong>Price:</strong><br/>
<input type=\"text\" name=\"event_price\" size=\"25\" maxlength=\"100\"/></p>
<p><strong>Dress Code:</strong><br/>
<input type=\"text\" name=\"dress_code\" size=\"25\" maxlength=\"100\"/></p>
<p><strong>Location:</strong><br/>
<input type=\"text\" name=\"event_local\" size=\"25\" maxlength=\"100\"/></p>
</td></tr>
<tr><td><center>";
require_once('recaptchalib.php');
  $publickey ="your public key from captcha";
  echo recaptcha_get_html($publickey);
echo "<br>
<input type=\"submit\" name=\"submit\" value=\"Add Event!\"></td>
<td><center><img src=\"../images/yourcustomimage.jpg\" height=\"200\" width=\"200\"><br>
Thanks for Updating!</td></tr>
</table>
</form>";
?>

</body>
</html>



and finally the verify.php
<?php
  require_once('recaptchalib.php');
  $privatekey = "your recaptcha key";
  $resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
         "(reCAPTCHA said: " . $resp->error . ")");
  } else {

	//Include database connection details
	include('config.php');

	//Connect to mysql server
	$mysql = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
	if(!$mysql) {
		die('Failed to connect to server: ' . mysql_error());
	} 
	mysql_select_db("yourtablename", $mysql) or die( "Unable to select database" .  mysql_error());

// Add our new events
if ($_POST){
	$m = $_POST['m'];
	$d = $_POST['d'];
	$y = $_POST['y'];

	// Formatting for SQL datetime (if this is edited, it will NOT work.)
	$event_date = $y."-".$m."-".$d." ".$_POST["event_time_hh"].":".$_POST["event_time_mm"].":00";

	$insEvent_sql = "INSERT INTO calendar_events (event_title,
			event_shortdesc, event_start, event_price, dress_code, event_local, event_link) VALUES('
			".$_POST["event_title"]."',
			'".$_POST["event_shortdesc"]."', 
			'$event_date',
			'".$_POST["event_price"]."', 
			'".$_POST["dress_code"]."', 
			'".$_POST["event_local"]."', 
			'".$_POST["event_link"]."')";
	$insEvent_res = mysql_query($insEvent_sql, $mysql)
			or die(mysql_error($mysql));
} else {
	$m = $_GET['m'];
	$d = $_GET['d'];
	$y = $_GET['y'];
}
// Show the events for this day:
$getEvent_sql = "SELECT event_title, event_shortdesc, event_local, event_link, 		event_price, dress_code, 
		date_format(event_start, '%l:%i %p') as fmt_date FROM
		calendar_events WHERE month(event_start) = '".$m."'
		AND dayofmonth(event_start) = '".$d."' AND
		year(event_start)= '".$y."'
		ORDER BY event_start";
$getEvent_res = mysql_query($getEvent_sql, $mysql)
		or die(mysql_error($mysql));

if (mysql_num_rows($getEvent_res) > 0){
	$event_txt = "<ul>";
	while($ev = @mysql_fetch_array($getEvent_res)){
		$event_title = stripslashes($ev["event_title"]);
		$event_shortdesc = stripslashes($ev["event_shortdesc"]);
		$fmt_date = $ev["fmt_date"];
		$event_price = $ev["event_price"];
		$dress_code = $ev["dress_code"];
		$event_local = $ev["event_local"];
		$event_link = $ev["event_link"];
		$event_txt .= "<li><strong><h3>".$event_title."</h3></strong>
			      ".$fmt_date." @ ".$event_local."<br/> Event Price: ".$event_price." | Dress Code: ".$dress_code."<p>".$event_shortdesc.
				  "<br/> Get more info at: <a href=http://".$event_link.">".$event_link."</a></li><p>";
	}
	$event_txt .="</ul>";
	mysql_free_result($getEvent_res);
} else {
	$event_txt = "";
}

mysql_close($mysql);

if ($event_txt != ""){
	echo "<p><strong>Today's Events:</strong></p>
	$event_txt
	<hr/>";
}
}
?>

</body>
</html>


Was This Post Helpful? 0
  • +
  • -

#17 yetiracing4als  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 22-September 11

Posted 22 September 2011 - 01:00 PM

Thanks for your post. I am working through the code you provided and was wondering if you could post your config.php file. Also, hoping to add on an admin front end and the option to check the database for available times.
Was This Post Helpful? 0
  • +
  • -

#18 Eluway  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 29-June 11

Posted 24 September 2011 - 01:01 PM

The config file just holds the access information to your database.

<?php
	define('DB_HOST', 'localhost');
    define('DB_USER', 'your username');
    define('DB_PASSWORD', 'your password');
    define('DB_DATABASE', 'the database name');
?>



As for the rest, I can't help you there. I'm still learning about creating users and managing logins.
Was This Post Helpful? 0
  • +
  • -

#19 parthmody90  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 24-January 12

Posted 26 January 2012 - 06:15 AM

anyone else getting all 1's when testing this code on a live server?
Was This Post Helpful? 0
  • +
  • -

#20 Eluway  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 29-June 11

Posted 26 January 2012 - 08:15 AM

View Postparthmody90, on 26 January 2012 - 06:15 AM, said:

anyone else getting all 1's when testing this code on a live server?



Yes I did when I first started mine. I can't remember what exactly fixed it but I did post my completed code somewhere in the replies and it is in perfect working order.
Was This Post Helpful? 0
  • +
  • -

#21 adejones  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 17-May 12

Posted 17 May 2012 - 08:18 AM

Hi Eluway

I have recreated your 3 files obviously with my own connection details and the calendar displays great.
The only problem I am having is that nothing happens when I actually click on a date.

Could you advise please?
Thanks, Adrian
Was This Post Helpful? 0
  • +
  • -

#22 Eluway  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 29-June 11

Posted 18 May 2012 - 01:48 AM

View Postadejones, on 17 May 2012 - 08:18 AM, said:

Hi Eluway

I have recreated your 3 files obviously with my own connection details and the calendar displays great.
The only problem I am having is that nothing happens when I actually click on a date.

Could you advise please?
Thanks, Adrian



Hello Adrian,

Can you post your code or direct me the site where the calendar is in action so I can take a look at it?
Was This Post Helpful? 0
  • +
  • -

#23 adejones  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 17-May 12

Posted 18 May 2012 - 03:23 AM

Hi Eluway
Thanks for your quick reply.
I have figured out it was a slight problem in IE, pop up works fine in Firefox.
But to rectify this, I am planning on integrating a fancybox iframe so that rather than the javascript window open link for the pop up, the events and form will appear in a nice looking iframe.

My calendar at the moment is at www.primarycarecommunity.net/test1/calendar.php

I also need to style it so that each date is bigger, because it looks a bit strange where it stretches to fit the text in.

My code is as follows:
Calendar.php
<?php
define ("DB_HOST", "localhost"); // set database host
define ("DB_USER", "username"); // set database user
define ("DB_PASS","password"); // set database password
define ("DB_NAME","dataname"); // set database name

$link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make connection.");
$db = mysql_select_db(DB_NAME, $link) or die("Couldn't select database");

define("ADAY", (60*60*24));

if ((!isset($_POST['month'])) || (!isset($_POST['year']))) {
	$nowArray = getdate();
	$month = $nowArray['mon'];
	$year = $nowArray['year'];
} else {
	$month = $_POST['month'];
	$year = $_POST['year'];
}
$start = mktime(12,0,0,$month,1,$year);
$firstDayArray = getdate($start);
?>
<html>
<head>
<title><?php echo "Calendar: ".$firstDayArray['month']."" . $firstDayArray['year']; ?></title>
</head>
<script type="text/javascript">
function eventWindow(url) {
	event_popupWin = window.open(url, 'event', 'resizable=yes,scrollbars=yes,toolbar=no,width=400,height=400');
	event_popupWin.opener = self;
}
</script>
<body>
<h1>Select a Month/Year</h1>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select name="month">
<?php
$months = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

for ($x=1; $x<=count($months); $x++){
	echo "<option value=\"$x\"";
	if ($x == $month){
		echo " selected";
	}
	echo ">".$months[$x-1]."</option>";
}
?>
</select>
<select name="year">
<?php
$thisYear = date('Y');
for ($x=$thisYear - 1; $x<= $thisYear + 2; $x++){
	echo "<option";
	if ($x == $year){
		echo " selected";
	}
	echo ">$x</option>";
}
?>
</select>
<input type="submit" name="submit" value="Go!">
</form>
<br />
<?php
$days = Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
echo "<table border=\"1\" cellpadding=\"5\"><tr>\n";
foreach ($days as $day) {
	echo "<td style=\"background-color: #CCCCCC; text-align: center; width: 14%\">
	      <strong>$day</strong></td>\n";
}

for ($count=0; $count < (6*7); $count++) {
	$dayArray = getdate($start);
	if (($count % 7) == 0) {
		if ($dayArray["mon"] != $month) {
			break;
		} else {
			echo "</tr><tr>\n";
		}
	}
	if ($count < $firstDayArray["wday"] || $dayArray["mon"] != $month) {
		echo "<td>&nbsp;</td>\n";
	} else {
		$chkEvent_sql = "SELECT event_title FROM calendar_events WHERE month(event_start) = '".$month."' AND dayofmonth(event_start) = '".$dayArray["mday"]."' AND year(event_start) = '".$year."' ORDER BY event_start";
		$chkEvent_res = mysql_query($chkEvent_sql) or die(mysql_error($mysql));

		if (mysql_num_rows($chkEvent_res) > 0) {
			$event_title = "<br/>";
			while ($ev = mysql_fetch_array($chkEvent_res)) {
				$event_title .= stripslashes($ev["event_title"])."<br/>";
			}
			mysql_free_result($chkEvent_res);
		} else {
			$event_title = "";
		}

		echo "<td valign=\"top\"><a href=\"javascript:eventWindow('event.php?m=".$month."&d=".$dayArray["mday"]."&y=$year');\">".$dayArray["mday"]."</a><br/>".$event_title."</td>\n";

		unset($event_title);

		$start += ADAY;
	}
}
echo "</tr></table>";
mysql_close();
?>
</body>
</html>




event.php
<html>
<head>
<title>Show / Add Events</title>
</head>
<body>
<h1><?php 
	if ($_POST){
		echo $_POST['d']." / " .  $_POST['m']." / " . $_POST['y'];
	}
	else {
		echo $_GET['d']." / " . $_GET['m']." / " . $_GET['y'];
		} 
?></h1> 
<?php
define ("DB_HOST", "localhost"); // set database host
define ("DB_USER", "username"); // set database user
define ("DB_PASS","password"); // set database password
define ("DB_NAME","dataname"); // set database name

$link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make connection.");
$db = mysql_select_db(DB_NAME, $link) or die("Couldn't select database");

// Add our new events
if ($_POST){
	$m = $_POST['m'];
	$d = $_POST['d'];
	$y = $_POST['y'];

	// Formatting for SQL datetime (if this is edited, it will NOT work.)
	$event_date = $y."-".$m."-".$d." ".$_POST["event_time_hh"].":".$_POST["event_time_mm"].":00";

	$insEvent_sql = "INSERT INTO calendar_events (event_title,
			event_shortdesc, event_start) VALUES('
			".$_POST["event_title"]."',
			'".$_POST["event_shortdesc"]."', '$event_date')";
	$insEvent_res = mysql_query($insEvent_sql)
			or die(mysql_error($mysql));
} else {
	$m = $_GET['m'];
	$d = $_GET['d'];
	$y = $_GET['y'];
}
// Show the events for this day:
$getEvent_sql = "SELECT event_title, event_shortdesc,
		date_format(event_start, '%l:%i %p') as fmt_date FROM
		calendar_events WHERE month(event_start) = '".$m."'
		AND dayofmonth(event_start) = '".$d."' AND
		year(event_start)= '".$y."' ORDER BY event_start";
$getEvent_res = mysql_query($getEvent_sql)
		or die(mysql_error($mysql));

if (mysql_num_rows($getEvent_res) > 0){
	$event_txt = "<ul>";
	while($ev = @mysql_fetch_array($getEvent_res)){
		$event_title = stripslashes($ev["event_title"]);
		$event_shortdesc = stripslashes($ev["event_shortdesc"]);
		$fmt_date = $ev["fmt_date"];

		$event_txt .= "<li><strong>".$fmt_date."</strong>:
			      ".$event_title."<br/>".$event_shortdesc."</li>";
	}
	$event_txt .="</ul>";
	mysql_free_result($getEvent_res);
} else {
	$event_txt = "";
}

mysql_close();

if ($event_txt != ""){
	echo "<p><strong>Today's Events:</strong></p>
	$event_txt
	<hr/>";
}

// Show form for adding the event:

echo "
<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">
<p><strong>Add Event:</strong><br/>
Complete the form below then press the submit button when you are done.</p>
<p><strong>Event Title:</strong><br/>
<input type=\"text\" name=\"event_title\" size=\"25\" maxlength=\"25\"/></p>
<p><strong>Event Description:</strong<br/>
<input type=\"text\" name=\"event_shortdesc\" size=\"25\" maxlength=\"255\"/></p>
<p><strong>Event Time (hh:mm):</strong><br/>
<select name=\"event_time_hh\">";
for ($x=1; $x<=24; $x++){
	echo "<option value=\"$x\">$x</option>";
}
echo "</select> :
<select name=\"event_time_mm\">
<option value=\"00\">00</option>
<option value=\"15\">15</option>
<option value=\"30\">30</option>
<option value=\"45\">45</option>
</select>
<input type=\"hidden\" name=\"m\" value=\"".$m."\">
<input type=\"hidden\" name=\"d\" value=\"".$d."\">
<input type=\"hidden\" name=\"y\" value=\"".$y."\">
<br/><br/>
<input type=\"submit\" name=\"submit\" value=\"Add Event!\">
</form>";
?>
</body>
</html>




Now I am presuming my fancybox iframe would work correctly if I remove this from calendar.php:
<script type="text/javascript">
function eventWindow(url) {
	event_popupWin = window.open(url, 'event', 'resizable=yes,scrollbars=yes,toolbar=no,width=400,height=400');
	event_popupWin.opener = self;
}
</script>



And change the date links to:
<a id="iframe" href="event.php?m=".$month."&d=".$dayArray["mday"]."&y=$year">".$dayArray["mday"]."</a>


Does that link look OK to you (have just removed the javascript bit)?

Thanks, Adrian
Was This Post Helpful? 0
  • +
  • -

#24 Eluway  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 29-June 11

Posted 18 May 2012 - 03:51 AM

Hi Adrian,

No worries and I'm glad that you figured out the problem.

In regards to the window change, honestly can't say that I've worked with the type of window you're trying. For a while I was attempting to have the pop-up window come up in a lightbox type of style but some other stuff came up and I haven't worked on it in a while.

Let me know how it works out for you and I'll keep posting any updates to the code that I make =-)
Was This Post Helpful? 0
  • +
  • -

#25 adejones  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 17-May 12

Posted 18 May 2012 - 04:09 AM

Well I have just tried to implement the iframe change but on changing the link and uploading, the page only displays this message:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/adejones/public_html/test1/calendar.php on line 110

Line 110 being the line with the link on:

echo "<td valign=\"top\"><a id="various3" href="event.php?m=".$month."&d=".$dayArray["mday"]."&y=$year">".$dayArray["mday"]."</a><br/>".$event_title."</td>\n";


(the original line being:)
<a href=\"javascript:eventWindow('event.php?m=".$month."&d=".$dayArray["mday"]."&y=$year');\">".$dayArray["mday"]."</a>


So how do I remove the javascript:eventWindow so it is just a normal link that can then be opened within the iframe using my ID.

Thanks, Adrian
Was This Post Helpful? 0
  • +
  • -

#26 adejones  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 17-May 12

Posted 18 May 2012 - 04:25 AM

BOOSH - hahahahaaaaa i've done it :-)

Check out my iframe pop up - http://www.primaryca...t1/calendar.php

Now for styling, and once it's looking pretty I can then integrate it in to my main site (on wordpress, ouch).

This is what I had to do with line 110:

echo "<td valign=\"top\"><a class=\"various3\" href=\"event.php?m=".$month."&d=".$dayArray["mday"]."&y=$year\">".$dayArray["mday"]."</a><br/>".$event_title."</td>\n";

Was This Post Helpful? 0
  • +
  • -

#27 Eluway  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 29-June 11

Posted 18 May 2012 - 04:32 AM

It looks great! Congrats! I think I might adapt my code to use your pop-up. Great job
Was This Post Helpful? 0
  • +
  • -

#28 adejones  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 17-May 12

Posted 18 May 2012 - 04:47 AM

Thanks Eluway, couldn't have done it without you.
Apart from styling, only thing I have to figure out now is how to get calendar.php to refresh when pop up is closed, so that the event will appear on calendar without user having to refresh the page.

Adrian
Was This Post Helpful? 0
  • +
  • -

#29 Sgleaton  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 14-June 12

Posted 14 June 2012 - 05:31 AM

This is very nice and a great start to what I am trying to achieve! I would like to be able to add the functionality of time and purchasing services to this. In other words I want to create an appointment calendar where clients can see availability of time and make purchase or indicate payment off-line. Do you know where I might find such code or point me in the right direction for modifying this script? I am new to PHP and trying to learn the nuances of using it. So far I like the way the programming language works! A lot more simple than ASP or ASP.NET!!
Was This Post Helpful? 0
  • +
  • -

#30 dtown  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 19-June 12

Posted 19 June 2012 - 01:28 PM

View PostEluway, on 26 January 2012 - 08:15 AM, said:

View Postparthmody90, on 26 January 2012 - 06:15 AM, said:

anyone else getting all 1's when testing this code on a live server?



Yes I did when I first started mine. I can't remember what exactly fixed it...


At the top of the first PHP block add this line:

define("ADAY", (60*60*24));

-- thanks to whoever first posted this code.
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3