Muhammad Muazzam
Muhammad Muazzam

Reputation: 2800

PHP Passing string with inner space

I have this code $_SESSION['akey'] = $row['akey'] and the value in $row['akey'] is

eosUb w wc

Note: Inner spaces between string

But value passes to $_SESSION['akey'] is only

eosUb

EDIT: click.php?refid=<?=$_SESSION['akey'] shows click.php?refid=eosUb

Upvotes: 0

Views: 57

Answers (2)

user3612383
user3612383

Reputation: 88

Try it :

click.php?refid=<?=urlencode($_SESSION['akey'])

EDIT: This should results: click.php?refid=eosUb+w+wc

Upvotes: 2

Armen
Armen

Reputation: 4202

My guess is that you have problem with new lines in your string during echo first make sure that var_dump( $_SESSION['akey'] ) brings you "eosUb w wc" then you can try to remove line breaks by

click.php?refid=<?= preg_replace('/\s+/', ' ', $_SESSION['akey'])); ?>

Upvotes: 1

Related Questions