Jump to content

Recommended Posts

I cant get the refresh link to include the varibles "day month year" for some reason. When I echo the varibles before the link they dont show either. the $date varible processes fine though so I'm lost....

 

<?php
$employee = $_SESSION['SESS_MEMBER_ID'];
$space = " ";
$date =$month . $space . $day . $comma . $year;
$nextdate = strtotime($date);
$finaldate = date("Y-m-d", $nextdate);
$event = $_POST['event'];
$time = $_POST['time'];
$user = $_SESSION['SESS_LOGIN'];
$datestamp = $date . $time;
$query = "INSERT INTO cal_events SET username = '$user', user_id = '$employee', date = '$finaldate', time ='$time', description = '$event'";
$result = mysql_query($query);
echo $query;
echo mysql_error();
echo $month;
echo "<meta http-equiv=refresh content=\"0; URL=day.php?day=$day&month=$month&year=$year\">";
?>

Link to comment
https://forums.phpfreaks.com/topic/141473-link-with-variables-problem/
Share on other sites

Try this:

 

 $query = "INSERT INTO cal_events SET username = '{$user}', user_id = '{$employee}', date = '{$finaldate}', time ='{$time}', description = '{$event}'";

 

Variables don't get evaluated in single quotes.  You need to either encapsulate them in french braces or concatenate to the string.

Try this:

 

 $query = "INSERT INTO cal_events SET username = '{$user}', user_id = '{$employee}', date = '{$finaldate}', time ='{$time}', description = '{$event}'";

 

Variables don't get evaluated in single quotes.  You need to either encapsulate them in french braces or concatenate to the string.

 

i think the OP is referring to the meta refresh at the bottom

Yeah, the query works fine... just this pesky link wont display variables like they are supposed to...

 

Here is more code...

<?php
$day = $_GET['day'];
$month = $_GET['month'];
$year = $_GET['year'];
$employee = $_SESSION['SESS_MEMBER_ID'];
if (isset($_POST['submit']))
			 {
$space = " ";
$date =$month . $space . $day . $comma . $year;
$nextdate = strtotime($date);
$finaldate = date("Y-m-d", $nextdate);
$event = $_POST['event'];
$time = $_POST['time'];
$user = $_SESSION['SESS_LOGIN'];
$datestamp = $date . $time;
$query = "INSERT INTO cal_events SET username = '$user', user_id = '$employee', date = '$finaldate', time ='$time', description = '$event'";
$result = mysql_query($query);
echo $query;
echo mysql_error();
echo $month;
echo "<meta http-equiv=refresh content=\"0; URL=day.php?day=$day&month=$month&year=$year\">";
			 }
			 else
			 {


				$comma1 = ", ";
				$space1 = " ";
				$date1 =$month . $space1 . $day . $comma1 . $year;
				$nextdate1 = strtotime($date1);
$finaldate1 = date("Y-m-d", $nextdate1);
				$query1= "SELECT time, description FROM cal_events WHERE date = '$finaldate1' AND user_id = '$employee'";
				 $result1=mysql_query($query1);
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.