I am trying to pass 2 strings from first.php file to second.php file-
In my first.php file, I tried to send data by
<?php echo "<a href='second.php?newFormat=$statusString&MACAddress=$macaddress'>link</a>"; ?>
and
<a href="second.php?newFormat="<?php echo $statusString; ?> &MACAddress=<?php echo $macaddress; ?>link</a>
and
<a href="second.php?newFormat=<?php echo urlencode($statusString);?>&MACAddress=<?php echo urlencode($macaddres); ?>"link</a>
I tried all of above possibilities. I get the same error -
PHP Parse error: syntax error, unexpected '<' in /var/www/html/first.php on line 176
My $statusString
is - "u=500000;t1=1479394;s=10;r=-33;v=3.7;"
My $macaddres
is - "500000"
Can anyone tell me how differently do I do this?
EDIT 1
I have tried to comment this line in my code, and the code works without any errors!
EDIT 2
if(Some condition)
{
$statusString = "u=".$macaddress.";t1=".$time.";s=10;r=-33;v=".$voltage.";";
<?php echo "<a href='second.php?newFormat=$statusString&MACAddress=$macaddress'>link</a>"; ?>
}
In my second.php file, I am retrieving these by-
if (isset($_GET['newFormat']))
{
$str = $_GET['newFormat'];
}
else
$str = 'no data';
if (isset($_GET['MACAddress']))
{
$macAddress = $_GET['MACAddress'];
}