Jump to content

Variable inside Session Variable


dmaru09

Recommended Posts

hey guys, looking to put a $ variable inside a session variable.

 

heres the code

 

  while($duedatesformat != '0')

  {

  $seperators = array(",", ".", "-", ":", "\;", "_", "`", "\\");

  $dtd1=str_replace($seperators, "/", $_SESSION['due_date_'.$duedatesformat].');

  $arrd1=split("/",$dtd1);

  $mmd1=$arrd1[0];

  $ddd1=$arrd1[1];

  $yyd1=$arrd1[2];

  $formattedDueDate1 = date("m/d/Y", mktime(0,0,0, $mmd1, $ddd1, $yyd1));

# ~~~~~ Checks for a valid date ~~~~~#

  if(!checkdate($mmd1,$ddd1,$yyd1))

{

  $_SESSION['e_due_date_'.$duedatesformat].' = "Invalid date.  Please re-enter your date.";

  $error = 1;

  echo '<meta HTTP-EQUIV="REFRESH" content="0; url=InsertMC.php">';

  }

 

$duedatesformat = $duedatesformat -1;

 

}

 

all of that works so far except for:

    $_SESSION['e_due_date_'.$duedatesformat].' = "Invalid date.  Please re-enter your date.";

 

I cannot figure out the correct format here.  Anyone know offhand?

 

 

 

Parse error: syntax error, unexpected T_STRING in /export/home/oracle/itcrapp/ITInvoice/InsertMC.php on line 296

 

Thats my error btw.

Link to comment
https://forums.phpfreaks.com/topic/164532-variable-inside-session-variable/
Share on other sites

Too many "." and "'", write it as

<?php
$_SESSION['e_due_date_'.$duedatesformat] = "Invalid date.  Please re-enter your date.";
?>

 

Ken

 

It appears that may have worked, but that this other line may be the cause of the problem.

 

$dtd1=str_replace($seperators, "/", $_SESSION['due_date_'.$duedatesformat].');

 

Any suggestions?

 

Thank you btw.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.