This topic is locked

smarty problem

7/16/2008 6:12:19 AM
PHPRunner General questions
M
mnhuda author

Hello,

I am saving user profiles in encrypted form. The encryption/decryption works fine.
My profile edit page uses a lookupwizard (i.e. combobox or dropdownbox) for 'city' field which comes from another talbe (containing list of cities).

When I goto edit page, it decrypts all data fields and shows them in the page except the dropdownbox field (i.e. city) whos value was supposed to be 'New York' without quotes. I see the following code in the profile_edit.php file near the bottom of the file.
$smarty->assign("value_City",@$data["City"]);
From debug, I found that $data["City"]) just before the above mentioned line gave a valid existing city name.
echo @$data["City"]; //this line prints 'New York' without quotes
Now to find the error, I modify the line as follows.
$smarty->assign("value_City", "New York");
This time the when I goto edit page, the dropdownbox shows the value. I dont know what is the problem. Can you help me please?
Regards

M
mnhuda author 7/16/2008

Hi again,

I checked the source file from the browser and found that $value_City got some value like "New York ". So, there are some trailing spaces, i.e. smarty didn't trim whitespaces while assigning value. So, I modify the line as follows and it works fine.
$smarty->assign("value_City",trim(@$data["City"]));
Regards