Why do you add quotes to the values you are saving? Doctrine will handle this for you. Try removing this part:
$name="'".$this->form->getValue('username')."'";
$message="'".$this->form->getValue('message')."'";
$email="'".$this->form->getValue('email')."'";
$sub="'".$this->form->getValue('subject')."'";
You're not utilising the power of Doctrine and forms fully.
E.g. instead of this:
$this->form = new ContactForm();
$this->rs = Doctrine::getTable('login')-> find($request->getParameter('id'));
$id=$request->getParameter('id');
$unm=$this->rs['username'];
$msg=$this->rs['message'];
$em=$this->rs['email'];
$sub=$this->rs['subject'];
$this->form->setDefault('id', $id);
$this->form->setDefault('username', $unm);
$this->form->setDefault('message', $msg);
$this->form->setDefault('email', $em);
$this->form->setDefault('subject', $sub);
You could use this:
$this->rs = Doctrine_Core::getTable('login')-> find($request->getParameter('id'));
$this->form = new ContactForm($this->rs);
You only have to "connect" your form to a proper model by adding this function:
public function getModelName()
{
return 'login';
}
You could then use the save
method on the form so it automatically saves your object without having to create the update query.
Also have a look at the sfValidatorFile
as it will automatically create a unique filename for you.