Fakhr Alam Fakhr Alam - 7 months ago 18
PHP Question

displaying cookie value inside textbox

i have to display a cookie value in textbox

but the value is surrounded with a lot of space on both sides

i am appying trim() but still not fixing

< ? php
uName="";
if(isset($_COOKIE["uName"]))
{ $uName=trim($_COOKIE["uName"]);}
?>
<input type="text" name="uName" value="<?php echo $uName; ?>">

Answer

I have solved it.
Error was here

<input type="text" value="<?php echo $_COOKIE["uName"]; ?>">

Now i have replaced this with

<input type="text" <?php echo "value='".$_COOKIE["uName"]."'"; ?> >

It's working fine now.