Hi guys,
I have a form where users update a posts information.
One of the sections is the following :
<td><input type="text" name="author" size="30" value="<?php poem_info($pid,author); ?>"></td>
as you can see I'm using php to populate the field. Here is the function poem_info():
function poem_info($pid,$record){
require_once '../classes.db_connect.php';
$db = new Database;
$query = 'SELECT '.$record.' FROM poems WHERE id = "'.$pid.'"';
$db->query($query);
$db->singleRecord(); // retrieve a single record
echo $db->Record[$record];
}
The problem I am having is that if I edit the information in the form and save it to the database it saves perfectly. If I check the database it's saved with no spaces before the user input.
But when I enter the form to edit the information a space is inserted and I can't figure out why. I have tried to use trim() but it's still not working and it's driving me mad. I know it's not the DB because when I log in and check it manually it's fine. So I must be doing something wrong somewhere else and it's killing me! Please help!