Sir, how to make these lines workable

        echo "<td align='center'><a href='register_edit.php?message=".base64_encode('date='.date('Y-m-d',strtotime($res['date'])).&".base64_encode('vou_no='.$res['vou_no']')> <img src='../images/time.ico' alt='Complet_History' title='Complete_History'></a></td>";

I want to pass two parameters.

Please

Member Avatar for diafol

Sorry but that is totally mashed up.

I want to pass two parameters.

But base64_encode() only takes one parameter: http://php.net/manual/en/function.base64-encode.php

Your quotes are all over the place; you include .& presumably as a concatenator (doesn't make sense); and your brackets don't balance.

Consider either using heredoc syntax, inline PHP echoes for html snippets - this makes parsing / escaping much easier and tidier.

//CREATE b64 var first
$dt = base64_encode('date='.date('Y-m-d',strtotime($res['date']))) 
        . base64_encode('vou_no='.$res['vou_no']');

//Method 1: Heredoc Syntax EXAMPLE      
$cell = <<<CELL
<td align='center'>
    <a href='register_edit.php?message=$dt>
        <img src='../images/time.ico' alt='Complet_History' title='Complete_History'>
    </a>
</td>
CELL;

echo $cell;

<!-- Method 2: Just HTML EXAMPLE-->
<td align='center'>
    <a href='register_edit.php?message=<?=$dt>'>
        <img src='../images/time.ico' alt='Complet_History' title='Complete_History'>
    </a>
</td>
commented: Much I marvelled this ungainly fowl to hear discourse so plainly, I hear you. +0

sir following command

        $dt = base64_encode('date='.date_format($res['date'],'Y-m-d')).base64_encode('vou_no='.$res['vou_no']);
        echo    $dt;

replies

date=2017-04-04vou_no=8

but I need

date=2017-04-04 and vou_no=8

want to add word and

I used this command but it does not work

    $dt = base64_encode('date='.date_format($res['date'],'Y-m-d')).'and'.base64_encode('vou_no='.$res['vou_no']);

Please help

Member Avatar for diafol

Ok build string first and then base64 it:

$str = 'date='. date_format($res['date'], 'Y-m-d') . ' and vou_no=' . $res['vou_no'];

You had unbalanced brackets again. I've inserted spaces between the "and". Up to you itf you want to keep them or not. Now...

$dt = base64_encode($str);

Then same as before...

commented: Unbalanced brackets, forces mean instability. +12

Thanks Sir but I need little more help

$str = 'date='.date_format($res['date'], 'Y-m-d').' and vou_no='. $res['vou_no'];
echo $str

it shows
date=2017-04-20 and vou_no=4

But I want this result
date='2017-04-20' and vou_no=4

Comma with date

So how to modify this string to get desired result

$str = 'date='.date_format($res['date'], 'Y-m-d').' and vou_no='. $res['vou_no'];

Please help

Member Avatar for diafol
$str = "date='" . date_format($res['date'], 'Y-m-d') . "' and vou_no=". $res['vou_no'];

Or:

$date = date_format($res['date'], 'Y-m-d');
$str = "date='$date' and vou_no={$res['vou_no']}";
$dt = base64_encode($str);

Additional lines are not a bad thing. They add clarity.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.